Alias definitions aren't supported on some platforms. Create a flag (TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS) that indicates this and stops us from creating aliases.
llvm-svn: 41882
diff --git a/llvm-gcc-4.0/gcc/config/darwin.h b/llvm-gcc-4.0/gcc/config/darwin.h
index 1a2e77e..950b18d 100644
--- a/llvm-gcc-4.0/gcc/config/darwin.h
+++ b/llvm-gcc-4.0/gcc/config/darwin.h
@@ -674,6 +674,9 @@
} while (0)
/* APPLE LOCAL begin LLVM */
+/* As in the warning above, alias definitions aren't supported on Mach-O. */
+#define TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS
+
/* weak_import, a Darwin special, does not make function definitions weak. */
#define TARGET_ADJUST_LLVM_LINKAGE(FN, DECL) \
do { \
diff --git a/llvm-gcc-4.0/gcc/llvm-backend.cpp b/llvm-gcc-4.0/gcc/llvm-backend.cpp
index b605cfb..033fbcb 100644
--- a/llvm-gcc-4.0/gcc/llvm-backend.cpp
+++ b/llvm-gcc-4.0/gcc/llvm-backend.cpp
@@ -677,7 +677,7 @@
else if (Function *F = dyn_cast<Function>(V))
F->eraseFromParent();
else
- assert(0 && "Unsuported global value");
+ assert(0 && "Unsupported global value");
TREE_ASM_WRITTEN(decl) = 1;
diff --git a/llvm-gcc-4.0/gcc/varasm.c b/llvm-gcc-4.0/gcc/varasm.c
index 25c9ab6..1d8f265 100644
--- a/llvm-gcc-4.0/gcc/varasm.c
+++ b/llvm-gcc-4.0/gcc/varasm.c
@@ -4762,7 +4762,12 @@
{
tree target_decl;
target_decl = find_decl_and_mark_needed (p->decl, p->target);
+#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS
+ if (target_decl)
+ warning ("%Jalias definitions not supported; ignored", target_decl);
+#else
emit_alias_to_llvm(p->decl, p->target, target_decl);
+#endif
}
#else
do_assemble_alias (p->decl, p->target);
@@ -4819,11 +4824,19 @@
alias. This saves a tad o memory. */
target_decl = find_decl_and_mark_needed (decl, target);
if (target_decl && TREE_ASM_WRITTEN (target_decl))
+ /* APPLE LOCAL begin LLVM */
+ {
#ifdef ENABLE_LLVM
- emit_alias_to_llvm(decl, target, target_decl);
+#ifdef TARGET_DOES_NOT_SUPPORT_ALIAS_DEFINITIONS
+ warning ("%Jalias definitions not supported; ignored", target_decl);
#else
- do_assemble_alias (decl, target);
+ emit_alias_to_llvm(decl, target, target_decl);
#endif
+#else
+ do_assemble_alias (decl, target);
+#endif
+ }
+ /* APPLE LOCAL end LLVM */
else
{
alias_pair p;