This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[patch] fix use of SYMBOL_FLAG_MACH_DEP for x86-darwin
- From: Eric Christopher <echristo at apple dot com>
- To: "gcc-patches at gcc dot gnu dot org Patches" <gcc-patches at gcc dot gnu dot org>, Geoffrey Keating <geoffk at apple dot com>
- Date: Thu, 07 Sep 2006 16:07:41 -0700
- Subject: [patch] fix use of SYMBOL_FLAG_MACH_DEP for x86-darwin
The darwin port uses SYMBOL_FLAG_MACH_DEP for MACHO_SYMBOL_FLAG_VARIABLE
which is set through the code, the x86 backend uses it for determining
whether or not a local symbol is within range. This patch redefines it
in the i386 backend.
Tested on i386-darwin and x86_64-darwin.
OK?
-eric
2006-09-07 Eric Christopher <echristo@apple.com>
* config/darwin.h (MACHO_SYMBOL_FLAG_VARIABLE): Update
comment.
* config/i386/darwin.h (MACHO_SYMBOL_FLAG_VARIABLE):
Redefine.
Index: darwin.h
===================================================================
--- darwin.h (revision 116758)
+++ darwin.h (working copy)
@@ -698,7 +698,9 @@ extern GTY(()) section * darwin_sections
/* Set on a symbol with SYMBOL_FLAG_FUNCTION or
MACHO_SYMBOL_FLAG_VARIABLE to indicate that the function or
- variable has been defined in this translation unit. */
+ variable has been defined in this translation unit.
+ When porting Mach-O to new architectures you need to make
+ sure these aren't clobbered by the backend. */
#define MACHO_SYMBOL_FLAG_VARIABLE (SYMBOL_FLAG_MACH_DEP)
#define MACHO_SYMBOL_FLAG_DEFINED ((SYMBOL_FLAG_MACH_DEP) << 1)
Index: i386/darwin.h
===================================================================
--- i386/darwin.h (revision 116758)
+++ i386/darwin.h (working copy)
@@ -223,3 +223,8 @@ __enable_execute_stack (void *addr)
#undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES darwin_set_default_type_attributes
+
+/* This needs to move since i386 uses the first flag and other flags are
+ used in Mach-O. */
+#undef MACHO_SYMBOL_FLAG_VARIABLE
+#define MACHO_SYMBOL_FLAG_VARIABLE ((SYMBOL_FLAG_MACH_DEP) << 3)