Commit 28df0b5a by Stan Shebs Committed by Stan Shebs

objc-act.c (handle_class_ref): Rewrite to flush target specific code and use new macro...

        * 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.

From-SVN: r41666
parent f37f462a
2001-04-28 Stan Shebs <shebs@apple.com> 2001-04-28 Stan Shebs <shebs@apple.com>
* 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.
* config/darwin.h (STANDARD_EXEC_PREFIX): Don't define. * config/darwin.h (STANDARD_EXEC_PREFIX): Don't define.
(NEXT_OBJC_RUNTIME): Define. (NEXT_OBJC_RUNTIME): Define.
......
...@@ -648,15 +648,15 @@ void alias_section (name, alias) \ ...@@ -648,15 +648,15 @@ void alias_section (name, alias) \
} \ } \
while (0) while (0)
#define DECLARE_UNRESOLVED_REFERENCE(NAME) \ #define ASM_DECLARE_UNRESOLVED_REFERENCE(FILE,NAME) \
do { extern FILE* asm_out_file; \ do { \
if (asm_out_file) { \ if (FILE) { \
if (flag_pic) \ if (flag_pic) \
fprintf (asm_out_file, "\t.lazy_reference "); \ fprintf (FILE, "\t.lazy_reference "); \
else \ else \
fprintf (asm_out_file, "\t.reference "); \ fprintf (FILE, "\t.reference "); \
assemble_name (asm_out_file, NAME); \ assemble_name (FILE, NAME); \
fprintf (asm_out_file, "\n"); \ fprintf (FILE, "\n"); \
} \ } \
} while (0) } while (0)
......
...@@ -8355,46 +8355,43 @@ handle_class_ref (chain) ...@@ -8355,46 +8355,43 @@ handle_class_ref (chain)
tree chain; tree chain;
{ {
const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain)); const char *name = IDENTIFIER_POINTER (TREE_VALUE (chain));
if (! flag_next_runtime) char *string = (char *) alloca (strlen (name) + 30);
{ tree decl;
tree decl; tree exp;
char *string = (char *) alloca (strlen (name) + 30);
tree exp;
sprintf (string, "%sobjc_class_name_%s", sprintf (string, "%sobjc_class_name_%s",
(flag_next_runtime ? "." : "__"), name); (flag_next_runtime ? "." : "__"), name);
/* Make a decl for this name, so we can use its address in a tree. */ #ifdef ASM_DECLARE_UNRESOLVED_REFERENCE
decl = build_decl (VAR_DECL, get_identifier (string), char_type_node); if (flag_next_runtime)
DECL_EXTERNAL (decl) = 1; {
TREE_PUBLIC (decl) = 1; ASM_DECLARE_UNRESOLVED_REFERENCE (asm_out_file, string);
return;
}
#endif
pushdecl (decl); /* Make a decl for this name, so we can use its address in a tree. */
rest_of_decl_compilation (decl, 0, 0, 0); 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)? */ /* Make following constant read-only, but only for GNU runtime. */
readonly_data_section (); 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. */ /* Align the section properly. */
assemble_constant_align (exp); assemble_constant_align (exp);
/* Inform the assembler about this new external thing. */ /* Inform the assembler about this new external thing. */
assemble_external (decl); assemble_external (decl);
/* Output a constant to reference this address. */ /* Output a constant to reference this address. */
output_constant (exp, int_size_in_bytes (string_type_node)); 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));
}
} }
static void static void
......
...@@ -6270,6 +6270,13 @@ in a category); and @var{sel_name} is the name of the selector. ...@@ -6270,6 +6270,13 @@ in a category); and @var{sel_name} is the name of the selector.
On systems where the assembler can handle quoted names, you can use this On systems where the assembler can handle quoted names, you can use this
macro to provide more human-readable names. macro to provide more human-readable names.
@findex ASM_DECLARE_UNRESOLVED_REFERENCE
@item ASM_DECLARE_UNRESOLVED_REFERENCE (@var{stream}, @var{name})
A C statement (sans semicolon) to output to the stdio stream
@var{stream} commands to declare that the label @var{name} is an
unresolved Objective-C class reference. This is only needed for targets
whose linkers have special support for NeXT-style runtimes.
@end table @end table
@node Initialization @node Initialization
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment