diff options
author | Steven Bosscher <steven@gcc.gnu.org> | 2012-06-19 20:44:47 +0000 |
---|---|---|
committer | Steven Bosscher <steven@gcc.gnu.org> | 2012-06-19 20:44:47 +0000 |
commit | 70f42967b3b48d63a8e90bd19b4277a64d6ccd21 (patch) | |
tree | 43b24c99ade8c59d05ac05d4aecbdd6ff2c2f406 /gcc/objc/objc-next-runtime-abi-01.c | |
parent | c85fd25b17ae5b2150c71826b04ffb71045d1b28 (diff) | |
download | gcc-70f42967b3b48d63a8e90bd19b4277a64d6ccd21.zip gcc-70f42967b3b48d63a8e90bd19b4277a64d6ccd21.tar.gz gcc-70f42967b3b48d63a8e90bd19b4277a64d6ccd21.tar.bz2 |
tm.texi.in (TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE, [...]): Add @hooks.
gcc/
* doc/tm.texi.in (TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE,
TARGET_OBJC_DECLARE_CLASS_DEFINITION): Add @hooks.
(ASM_DECLARE_CLASS_REFERENCE, ASM_DECLARE_UNRESOLVED_REFERENCE):
Remove.
* doc/tm.texi: Regenerate.
* config/darwin.h (ASM_OUTPUT_LABELREF): Remove special case for
.objc_class_name_*.
* config/darwin-c.c: Include target.h.
(darwin_objc_declare_unresolved_class_reference): New function.
(darwin_objc_declare_class_definition): New function.
(TARGET_OBJC_DECLARE_UNRESOLVED_CLASS_REFERENCE): Define.
(TARGET_OBJC_DECLARE_CLASS_DEFINITION): Define.
c-family/
* c-target.def (objc_declare_unresolved_class_reference,
objc_declare_class_definition): Add new hooks.
objc/
* objc-next-runtime-abi-01.c: Do not include tm.h and output.h.
Include c-family/c-target.h.
(handle_next_class_ref): Rewrite to emit top-level asm statements.
(handle_next_impent): Likewise.
* objc/Make-lang.in: Fix dependencies for objc-next-runtime-abi-01.o.
From-SVN: r188793
Diffstat (limited to 'gcc/objc/objc-next-runtime-abi-01.c')
-rw-r--r-- | gcc/objc/objc-next-runtime-abi-01.c | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c index 151930e..b60bd46 100644 --- a/gcc/objc/objc-next-runtime-abi-01.c +++ b/gcc/objc/objc-next-runtime-abi-01.c @@ -26,7 +26,6 @@ along with GCC; see the file COPYING3. If not see #include "config.h" #include "system.h" #include "coretypes.h" -#include "tm.h" #include "tree.h" #ifdef OBJCPLUS @@ -49,7 +48,7 @@ along with GCC; see the file COPYING3. If not see #include "ggc.h" #include "target.h" -#include "output.h" /* for asm_out_file */ +#include "c-family/c-target.h" #include "tree-iterator.h" #include "objc-runtime-hooks.h" @@ -2267,47 +2266,50 @@ generate_objc_symtab_decl (void) init_objc_symtab (TREE_TYPE (UOBJC_SYMBOLS_decl))); } +/* Any target implementing NeXT ObjC m32 ABI has to ensure that objects + refer to, and define, symbols that enforce linkage of classes into the + executable image, preserving unix archive semantics. + + At present (4.8), the only targets implementing this are Darwin; these + use top level asms to implement a scheme (see config/darwin-c.c). The + latter method is a hack, but compatible with LTO see also PR48109 for + further discussion and other possible methods. */ static void -handle_next_class_ref (tree chain) +handle_next_class_ref (tree chain ATTRIBUTE_UNUSED) { - const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain)); - char *string = (char *) alloca (strlen (name) + 30); - - sprintf (string, ".objc_class_name_%s", name); - -#ifdef ASM_DECLARE_UNRESOLVED_REFERENCE - ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string); -#else - return ; /* NULL build for targets other than Darwin. */ -#endif + if (targetcm.objc_declare_unresolved_class_reference) + { + const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain)); + char *string = (char *) alloca (strlen (name) + 30); + sprintf (string, ".objc_class_name_%s", name); + targetcm.objc_declare_unresolved_class_reference (string); + } } static void -handle_next_impent (struct imp_entry *impent) +handle_next_impent (struct imp_entry *impent ATTRIBUTE_UNUSED) { - char buf[BUFSIZE]; - - switch (TREE_CODE (impent->imp_context)) + if (targetcm.objc_declare_class_definition) { - case CLASS_IMPLEMENTATION_TYPE: - snprintf (buf, BUFSIZE, ".objc_class_name_%s", - IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context))); - break; - case CATEGORY_IMPLEMENTATION_TYPE: - snprintf (buf, BUFSIZE, "*.objc_category_name_%s_%s", - IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)), - IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context))); - break; - default: - return; - } + char buf[BUFSIZE]; -#ifdef ASM_DECLARE_CLASS_REFERENCE - ASM_DECLARE_CLASS_REFERENCE (asm_out_file, buf); -#else - return ; /* NULL build for targets other than Darwin. */ -#endif + switch (TREE_CODE (impent->imp_context)) + { + case CLASS_IMPLEMENTATION_TYPE: + snprintf (buf, BUFSIZE, ".objc_class_name_%s", + IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context))); + break; + case CATEGORY_IMPLEMENTATION_TYPE: + snprintf (buf, BUFSIZE, "*.objc_category_name_%s_%s", + IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context)), + IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context))); + break; + default: + return; + } + targetcm.objc_declare_class_definition (buf); + } } static void @@ -2414,9 +2416,7 @@ objc_generate_v1_next_metadata (void) /* Dump the class references. This forces the appropriate classes to be linked into the executable image, preserving unix archive - semantics. This can be removed when we move to a more dynamically - linked environment. */ - + semantics. */ for (chain = cls_ref_chain; chain; chain = TREE_CHAIN (chain)) { handle_next_class_ref (chain); |