summaryrefslogtreecommitdiffstats
path: root/gcc/objc
diff options
context:
space:
mode:
authorshebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-29 00:12:51 +0000
committershebs <shebs@138bc75d-0d04-0410-961f-82ee72b054a4>2001-04-29 00:12:51 +0000
commit46a0fe077eabb1fccc491403e03f12299a1c83db (patch)
treec3a72e15a098bd16c87919299d256399f54003cf /gcc/objc
parentf5e2325a1bf5298c7009367bb4114568a3474a28 (diff)
downloadppe42-gcc-46a0fe077eabb1fccc491403e03f12299a1c83db.tar.gz
ppe42-gcc-46a0fe077eabb1fccc491403e03f12299a1c83db.zip
* objc/objc-act.c (handle_class_ref): Rewrite to flush target
specific code and use new macro ASM_DECLARE_UNRESOLVED_REFERENCE. * config/darwin.h (ASM_DECLARE_UNRESOLVED_REFERENCE): Define. * tm.texi (ASM_DECLARE_UNRESOLVED_REFERENCE): Document. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@41666 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/objc')
-rw-r--r--gcc/objc/objc-act.c61
1 files changed, 29 insertions, 32 deletions
diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 75789bf3e5f..d29c6f20ab9 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -8355,46 +8355,43 @@ handle_class_ref (chain)
tree chain;
{
const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain));
- if (! flag_next_runtime)
- {
- tree decl;
- char *string = (char *) alloca (strlen (name) + 30);
- tree exp;
+ char *string = (char *) alloca (strlen (name) + 30);
+ tree decl;
+ tree exp;
- sprintf (string, "%sobjc_class_name_%s",
- (flag_next_runtime ? "." : "__"), name);
+ sprintf (string, "%sobjc_class_name_%s",
+ (flag_next_runtime ? "." : "__"), name);
- /* Make a decl for this name, so we can use its address in a tree. */
- decl = build_decl (VAR_DECL, get_identifier (string), char_type_node);
- DECL_EXTERNAL (decl) = 1;
- TREE_PUBLIC (decl) = 1;
+#ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
+ if (flag_next_runtime)
+ {
+ ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
+ return;
+ }
+#endif
- pushdecl (decl);
- rest_of_decl_compilation (decl, 0, 0, 0);
+ /* Make a decl for this name, so we can use its address in a tree. */
+ decl = build_decl (VAR_DECL, get_identifier (string), char_type_node);
+ DECL_EXTERNAL (decl) = 1;
+ TREE_PUBLIC (decl) = 1;
+
+ pushdecl (decl);
+ rest_of_decl_compilation (decl, 0, 0, 0);
- /* Make following constant read-only (why not)? */
- readonly_data_section ();
+ /* Make following constant read-only, but only for GNU runtime. */
+ if (!flag_next_runtime)
+ readonly_data_section ();
- exp = build1 (ADDR_EXPR, string_type_node, decl);
+ exp = build1 (ADDR_EXPR, string_type_node, decl);
- /* Align the section properly. */
- assemble_constant_align (exp);
+ /* Align the section properly. */
+ assemble_constant_align (exp);
- /* Inform the assembler about this new external thing. */
- assemble_external (decl);
+ /* Inform the assembler about this new external thing. */
+ assemble_external (decl);
- /* Output a constant to reference this address. */
- output_constant (exp, int_size_in_bytes (string_type_node));
- }
- else
- {
- /* This overreliance on our assembler (i.e. lack of portability)
- should be dealt with at some point. The GNU strategy (above)
- won't work either, but it is a start. */
- char *string = (char *) alloca (strlen (name) + 30);
- sprintf (string, ".reference .objc_class_name_%s", name);
- assemble_asm (my_build_string (strlen (string) + 1, string));
- }
+ /* Output a constant to reference this address. */
+ output_constant (exp, int_size_in_bytes (string_type_node));
}
static void
OpenPOWER on IntegriCloud