Port of r41882: 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: 41883
diff --git a/llvm-gcc-4.2/gcc/config/darwin.h b/llvm-gcc-4.2/gcc/config/darwin.h
index e661eeb..e460b37 100644
--- a/llvm-gcc-4.2/gcc/config/darwin.h
+++ b/llvm-gcc-4.2/gcc/config/darwin.h
@@ -583,6 +583,9 @@
   } while (0)
 
 /* LLVM LOCAL begin */
+/* 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.2/gcc/varasm.c b/llvm-gcc-4.2/gcc/varasm.c
index 179f789..764787f 100644
--- a/llvm-gcc-4.2/gcc/varasm.c
+++ b/llvm-gcc-4.2/gcc/varasm.c
@@ -5177,7 +5177,12 @@
         }
               
       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);
@@ -5260,7 +5265,11 @@
   target_decl = find_decl_and_mark_needed (decl, target);
   if (target_decl && TREE_ASM_WRITTEN (target_decl))
 #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
+      emit_alias_to_llvm(decl, target, target_decl);
+#endif
 #else
   do_assemble_alias (decl, target);
 #endif