objc-act.c (handle_impent): Rewrite to be more portable and to use ASM_DECLARE_CLASS_...
authorStan Shebs <shebs@apple.com>
Thu, 28 Jun 2001 01:34:25 +0000 (01:34 +0000)
committerStan Shebs <shebs@gcc.gnu.org>
Thu, 28 Jun 2001 01:34:25 +0000 (01:34 +0000)
        * objc/objc-act.c (handle_impent): Rewrite to be more portable
        and to use ASM_DECLARE_CLASS_REFERENCE.
        * config/darwin.h (ASM_DECLARE_CLASS_REFERENCE): Rename from
        undocumented DECLARE_CLASS_REFERENCE, add file argument.
        * doc/tm.texi (ASM_DECLARE_CLASS_REFERENCE): Document.

From-SVN: r43622

gcc/ChangeLog
gcc/config/darwin.h
gcc/doc/tm.texi
gcc/objc/objc-act.c

index 3f374681d8457e6344cb3de6e36a0bd63e531a5f..854a569ffc9617a1e920252f700b0ae0ec4cabd0 100644 (file)
@@ -1,3 +1,11 @@
+2001-06-27  Stan Shebs  <shebs@apple.com>
+
+       * objc/objc-act.c (handle_impent): Rewrite to be more portable
+       and to use ASM_DECLARE_CLASS_REFERENCE.
+       * config/darwin.h (ASM_DECLARE_CLASS_REFERENCE): Rename from
+       undocumented DECLARE_CLASS_REFERENCE, add file argument.
+       * doc/tm.texi (ASM_DECLARE_CLASS_REFERENCE): Document.
+
 Wed Jun 27 18:01:09 2001  Jeffrey A Law  (law@cygnus.com)
 
        * simplify-rtx.c (simplify_rtx): Canonicalize commutative expressions
@@ -1122,7 +1130,7 @@ Tue Jun 12 12:20:12 CEST 2001  Jan Hubicka  <jh@suse.cz>
 
 2001-06-11  Stan Shebs  <shebs@apple.com>
 
-       * darwin.h (ASM_FILE_END): Remove decl of language_string.
+       * config/darwin.h (ASM_FILE_END): Remove decl of language_string.
 
 2001-06-11  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
 
@@ -1178,7 +1186,7 @@ Tue Jun 12 12:20:12 CEST 2001  Jan Hubicka  <jh@suse.cz>
 
 2001-06-11  Stan Shebs  <shebs@apple.com>
 
-       * darwin.c (darwin_encode_section_info):  Rewrite to simplify
+       * config/darwin.c (darwin_encode_section_info):  Rewrite to simplify
        and fix coding mistakes.
 
 2001-06-11  Nick Clifton  <nickc@cambridge.redhat.com>
index d90af772a2a6347a66ad5c264820bad89cb5da51..c3a0a91c613a67b5ba90729d18ec5960f8f5a96e 100644 (file)
@@ -663,12 +663,12 @@ void alias_section (name, alias)                  \
         }                                                              \
        } while (0)
 
-#define DECLARE_CLASS_REFERENCE(NAME) \
-    do { extern FILE* asm_out_file;                                    \
-        if (asm_out_file) {                                            \
-          fprintf (asm_out_file, "\t");                                \
-          assemble_name (asm_out_file, NAME);                          \
-          fprintf (asm_out_file, "=0\n");                              \
+#define ASM_DECLARE_CLASS_REFERENCE(FILE,NAME)                         \
+    do {                                                               \
+        if (FILE) {                                                    \
+          fprintf (FILE, "\t");                                        \
+          assemble_name (FILE, NAME);                                  \
+          fprintf (FILE, "=0\n");                                      \
           assemble_global (NAME);                                      \
         }                                                              \
        } while (0)
index 124a05f345e480b12b2354505663575f713b6667..991672cd3538b6b47985db6fd4cd0baeda73ee53 100644 (file)
@@ -6374,6 +6374,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
 macro to provide more human-readable names.
 
+@findex ASM_DECLARE_CLASS_REFERENCE
+@item ASM_DECLARE_CLASS_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
+Objective-C class reference.  This is only needed for targets whose
+linkers have special support for NeXT-style runtimes.
+
 @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
index af9a8bb858dec099f94f3caeb4dbee8e73f08120..f059472112a197b0b38e533e473a47b81d3ca35b 100644 (file)
@@ -8392,6 +8392,8 @@ static void
 handle_impent (impent)
      struct imp_entry *impent;
 {
+  char *string;
+
   implementation_context = impent->imp_context;
   implementation_template = impent->imp_template;
 
@@ -8399,62 +8401,45 @@ handle_impent (impent)
     {
       const char *class_name =
        IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
-      char *string = (char *) alloca (strlen (class_name) + 30);
 
-      if (flag_next_runtime)
-       {
-         /* Grossly unportable.
-            People should know better than to assume
-            such things about assembler syntax!  */
-         sprintf (string, ".objc_class_name_%s=0", class_name);
-         assemble_asm (my_build_string (strlen (string) + 1, string));
-
-         sprintf (string, ".globl .objc_class_name_%s", class_name);
-         assemble_asm (my_build_string (strlen (string) + 1, string));
-       }
+      string = (char *) alloca (strlen (class_name) + 30);
 
-      else
-       {
-         sprintf (string, "%sobjc_class_name_%s",
-                  (flag_next_runtime ? "." : "__"), class_name);
-         assemble_global (string);
-         assemble_label (string);
-       }
+      sprintf (string, "*%sobjc_class_name_%s",
+               (flag_next_runtime ? "." : "__"), class_name);
     }
-
   else if (TREE_CODE (impent->imp_context) == CATEGORY_IMPLEMENTATION_TYPE)
     {
       const char *class_name =
        IDENTIFIER_POINTER (CLASS_NAME (impent->imp_context));
       const char *class_super_name =
-       IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context));
-      char *string = (char *) alloca (strlen (class_name)
-                                     + strlen (class_super_name) + 30);
+        IDENTIFIER_POINTER (CLASS_SUPER_NAME (impent->imp_context));
 
-      /* Do the same for categories.  Even though no references to these
-        symbols are generated automatically by the compiler, it gives
-        you a handle to pull them into an archive by hand.  */
-      if (flag_next_runtime)
-       {
-         /* Grossly unportable.  */
-         sprintf (string, ".objc_category_name_%s_%s=0",
-                  class_name, class_super_name);
-         assemble_asm (my_build_string (strlen (string) + 1, string));
-
-         sprintf (string, ".globl .objc_category_name_%s_%s",
-                  class_name, class_super_name);
-         assemble_asm (my_build_string (strlen (string) + 1, string));
-       }
+      string = (char *) alloca (strlen (class_name)
+                               + strlen (class_super_name) + 30);
 
-      else
-       {
-         sprintf (string, "%sobjc_category_name_%s_%s",
-                  (flag_next_runtime ? "." : "__"),
-                  class_name, class_super_name);
-         assemble_global (string);
-         assemble_label (string);
-       }
+      /* Do the same for categories.  Even though no references to
+         these symbols are generated automatically by the compiler, it
+         gives you a handle to pull them into an archive by hand. */
+      sprintf (string, "*%sobjc_category_name_%s_%s",
+               (flag_next_runtime ? "." : "__"), class_name, class_super_name);
+    }
+  else
+    return;
+
+#ifdef ASM_DECLARE_CLASS_REFERENCE
+  if (flag_next_runtime)
+    {
+      ASM_DECLARE_CLASS_REFERENCE (asm_out_file, string);
+      return;
     }
+#endif
+
+  /* (Should this be a routine in varasm.c?) */
+  readonly_data_section ();
+  assemble_global (string);
+  assemble_align (UNITS_PER_WORD);
+  assemble_label (string);
+  assemble_zeros (UNITS_PER_WORD);
 }
 \f
 void