[llvm-commits] [llvm-gcc-4.2] r46281 - in /llvm-gcc-4.2/trunk/gcc: config/darwin.h objc/objc-act.c
Bill Wendling
isanbard at gmail.com
Wed Jan 23 13:41:06 PST 2008
Author: void
Date: Wed Jan 23 15:41:05 2008
New Revision: 46281
URL: http://llvm.org/viewvc/llvm-project?rev=46281&view=rev
Log:
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.2/trunk/gcc/config/darwin.h
llvm-gcc-4.2/trunk/gcc/objc/objc-act.c
Modified: llvm-gcc-4.2/trunk/gcc/config/darwin.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/config/darwin.h?rev=46281&r1=46280&r2=46281&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/config/darwin.h (original)
+++ llvm-gcc-4.2/trunk/gcc/config/darwin.h Wed Jan 23 15:41:05 2008
@@ -949,15 +949,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.2/trunk/gcc/objc/objc-act.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/objc/objc-act.c?rev=46281&r1=46280&r2=46281&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/objc/objc-act.c (original)
+++ llvm-gcc-4.2/trunk/gcc/objc/objc-act.c Wed Jan 23 15:41:05 2008
@@ -18388,12 +18388,6 @@
else
return;
- /* LLVM LOCAL begin */
-#ifdef ENABLE_LLVM
-#undef ASM_DECLARE_CLASS_REFERENCE
-#endif
- /* LLVM LOCAL end */
-
#ifdef ASM_DECLARE_CLASS_REFERENCE
if (flag_next_runtime)
{
More information about the llvm-commits
mailing list