[llvm-commits] [llvm-gcc-4.0] r46282 - in /llvm-gcc-4.0/trunk/gcc: config/darwin.h objc/objc-act.c
Bill Wendling
isanbard at gmail.com
Wed Jan 23 14:14:59 PST 2008
Author: void
Date: Wed Jan 23 16:14:50 2008
New Revision: 46282
URL: http://llvm.org/viewvc/llvm-project?rev=46282&view=rev
Log:
Backport of r46281:
GCC barfs this to the .s file directly:
.objc_class_name_CrashTestPlugin=0
.globl .objc_class_name_CrashTestPlugin
without creating a tree node or anything. We, on the other hand, are creating a
tree node and outputting:
.globl .objc_class_name_CrashTestPlugin
.zerofill __DATA, __common, .objc_class_name_CrashTestPlugin, 4, 2
This causes a linker crash because it's in the wrong section:
(undefined [lazy bound]) external [no dead strip] .objc_class_name_NSObject
00000000 (__TEXT,__text) non-external _-[CrashTestPlugin crash]
000000d8 (__DATA,__common) external [no dead strip] .objc_class_name_CrashTestPlugin
The .objc_class_name_CrashTestPlugin symbol is bad. It should look like:
00000000 (absolute) external .objc_class_name_CrashTestPlugin
Because it's barfed out directly to the file, we do the same with a file asm
directive.
Modified:
llvm-gcc-4.0/trunk/gcc/config/darwin.h
llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.0/trunk/gcc/config/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/config/darwin.h?rev=46282&r1=46281&r2=46282&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/config/darwin.h (original)
+++ llvm-gcc-4.0/trunk/gcc/config/darwin.h Wed Jan 23 16:14:50 2008
@@ -1410,15 +1410,31 @@
/* LLVM LOCAL */
#endif /*ENABLE_LLVM*/
-#define ASM_DECLARE_CLASS_REFERENCE(FILE,NAME) \
- do { \
- if (FILE) { \
- fprintf (FILE, "\t"); \
- assemble_name (FILE, NAME); \
- fprintf (FILE, "=0\n"); \
- (*targetm.asm_out.globalize_label) (FILE, NAME); \
- } \
- } while (0)
+/* LLVM LOCAL begin */
+#ifdef ENABLE_LLVM
+#define ASM_DECLARE_CLASS_REFERENCE(FILE,NAME) \
+ do { \
+ if (FILE) { \
+ char *Buffer = alloca(strlen(NAME)+30); \
+ sprintf(Buffer, "\t%s=0", NAME); \
+ llvm_emit_file_scope_asm(Buffer); \
+ sprintf(Buffer, "\t.globl %s", NAME); \
+ llvm_emit_file_scope_asm(Buffer); \
+ } \
+ } while (0)
+#else
+/* LLVM LOCAL end */
+#define ASM_DECLARE_CLASS_REFERENCE(FILE,NAME) \
+ do { \
+ if (FILE) { \
+ fprintf (FILE, "\t"); \
+ assemble_name (FILE, NAME); \
+ fprintf (FILE, "=0\n"); \
+ (*targetm.asm_out.globalize_label) (FILE, NAME); \
+ } \
+ } while (0)
+/* LLVM LOCAL */
+#endif /*ENABLE_LLVM*/
/* Globalizing directive for a label. */
#define GLOBAL_ASM_OP ".globl "
Modified: llvm-gcc-4.0/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.0/trunk/gcc/objc/objc-act.c?rev=46282&r1=46281&r2=46282&view=diff
==============================================================================
--- llvm-gcc-4.0/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.0/trunk/gcc/objc/objc-act.c Wed Jan 23 16:14:50 2008
@@ -18452,12 +18452,6 @@
else
return;
- /* APPLE LOCAL begin LLVM */
-#ifdef ENABLE_LLVM
-#undef ASM_DECLARE_CLASS_REFERENCE
-#endif
- /* APPLE LOCAL end LLVM */
-
#ifdef ASM_DECLARE_CLASS_REFERENCE
if (flag_next_runtime)
{
More information about the llvm-commits
mailing list