c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIA...
authorH.J. Lu <hjl@gnu.org>
Tue, 17 Jul 2001 12:55:19 +0000 (12:55 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Tue, 17 Jul 2001 12:55:19 +0000 (12:55 +0000)
* c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and
ASM_OUTPUT_WEAK_ALIAS are defined.
* defaults.h (ASM_OUTPUT_WEAK_ALIAS): Define if possible.
* config/mips/iris6.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL):
Moved ...
* config/mips/iris5.h: ... here.
(HANDLE_SYSV_PRAGMA): Defined as 1.
* varasm.c (weak_finish): Use ASM_OUTPUT_WEAK_ALIAS.
* doc/tm.texi (ASM_OUTPUT_WEAK_ALIAS): Support the undefined weak
symbol.

Co-Authored-By: Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
From-SVN: r44072

gcc/ChangeLog
gcc/c-pragma.h
gcc/config/mips/iris5.h
gcc/config/mips/iris6.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/varasm.c

index 48466608a65518da48ec7a8d23b3bae25bab4e42..ce3195a658699b807b2c8ce5341739e685a079cc 100644 (file)
@@ -1,3 +1,17 @@
+2001-07-17  H.J. Lu <hjl@gnu.org>
+           Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
+
+       * c-pragma.h (HANDLE_PRAGMA_WEAK): Define iff ASM_WEAKEN_LABEL and
+       ASM_OUTPUT_WEAK_ALIAS are defined.
+       * defaults.h (ASM_OUTPUT_WEAK_ALIAS): Define if possible.
+       * config/mips/iris6.h (ASM_OUTPUT_WEAK_ALIAS, ASM_WEAKEN_LABEL):
+       Moved ...
+       * config/mips/iris5.h: ... here.
+       (HANDLE_SYSV_PRAGMA): Defined as 1.
+       * varasm.c (weak_finish): Use ASM_OUTPUT_WEAK_ALIAS.
+       * doc/tm.texi (ASM_OUTPUT_WEAK_ALIAS): Support the undefined weak
+       symbol.
+
 2001-07-17  Joseph S. Myers  <jsm28@cam.ac.uk>
 
        * c-parse.in (all_prefix_attributes): New variable.
index d15c3e5d35a8c83f1e90f2b084f2c0255327c9ee..89ee4a7ef551e9bd5b795bc3541e434523291472 100644 (file)
@@ -1,5 +1,5 @@
 /* Pragma related interfaces.
-   Copyright (C) 1995, 1998, 1999, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
 
 This file is part of GNU CC.
 
@@ -22,9 +22,9 @@ Boston, MA 02111-1307, USA.  */
 #define GCC_C_PRAGMA_H
 
 #ifdef HANDLE_SYSV_PRAGMA
-/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_DEF are
+/* Support #pragma weak iff ASM_WEAKEN_LABEL and ASM_OUTPUT_WEAK_ALIAS are
    defined.  */
-#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_DEF)
+#if defined (ASM_WEAKEN_LABEL) && defined (ASM_OUTPUT_WEAK_ALIAS)
 #define HANDLE_PRAGMA_WEAK SUPPORTS_WEAK
 #endif
 
index 59d172c96e8073726273e1e19a46b607c9ebe175..eab210f9d44f10e1fd4180ee025b67fc02c86525 100644 (file)
@@ -170,3 +170,26 @@ do {                                                       \
   tree name_tree = get_identifier (NAME);              \
   TREE_ASM_WRITTEN (name_tree) = 1;                    \
 } while (0)
+
+/* This is how we tell the assembler that a symbol is weak.  */
+
+#define ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, VALUE)       \
+  do                                                   \
+    {                                                  \
+      ASM_GLOBALIZE_LABEL (FILE, NAME);                        \
+      fputs ("\t.weakext\t", FILE);                    \
+      assemble_name (FILE, NAME);                      \
+      if (VALUE)                                       \
+        {                                              \
+          fputc (' ', FILE);                           \
+          assemble_name (FILE, VALUE);                 \
+        }                                              \
+      fputc ('\n', FILE);                              \
+    }                                                  \
+  while (0)
+
+#define ASM_WEAKEN_LABEL(FILE, NAME) ASM_OUTPUT_WEAK_ALIAS(FILE, NAME, 0)
+
+/* Handle #pragma weak and #pragma pack.  */
+#undef HANDLE_SYSV_PRAGMA
+#define HANDLE_SYSV_PRAGMA 1
index 6f45cbb385f2aabcb07c87da0ad34b6e2ecbbed8..bec3414f14f4dcf5c040a360facaa253dfeb6ad9 100644 (file)
@@ -207,23 +207,6 @@ Boston, MA 02111-1307, USA.  */
 #define TYPE_ASM_OP    "\t.type\t"
 #define SIZE_ASM_OP    "\t.size\t"
 
-/* This is how we tell the assembler that a symbol is weak.  */
-
-#define ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,VALUE) \
- do {                                          \
-  ASM_GLOBALIZE_LABEL (FILE, NAME);            \
-  fputs ("\t.weakext\t", FILE);                        \
-  assemble_name (FILE, NAME);                  \
-  if (VALUE)                                   \
-    {                                          \
-      fputc (' ', FILE);                       \
-      assemble_name (FILE, VALUE);             \
-    }                                          \
-  fputc ('\n', FILE);                          \
- } while (0)
-
-#define ASM_WEAKEN_LABEL(FILE,NAME) ASM_OUTPUT_WEAK_ALIAS(FILE,NAME,0)
-
 /* Irix assembler does not support the init_priority C++ attribute.  */
 #undef SUPPORTS_INIT_PRIORITY
 #define SUPPORTS_INIT_PRIORITY 0
index a1001b992591a8514dacd0c48a6eb6abd8b0d3fe..ed5be8bcf6e2198a45dc2d052f151b6b63e8662e 100644 (file)
@@ -142,6 +142,18 @@ do { ASM_OUTPUT_LABEL(FILE,LABEL_ALTERNATE_NAME (INSN)); } while (0)
   ASM_OUTPUT_INTERNAL_LABEL (FILE, PREFIX, NUM)
 #endif
 
+/* This is how we tell the assembler that a symbol is weak.  */
+#if !defined (ASM_OUTPUT_WEAK_ALIAS) && defined (ASM_OUTPUT_DEF)
+#define ASM_OUTPUT_WEAK_ALIAS(STREAM, NAME, VALUE)     \
+  do                                                   \
+    {                                                  \
+      ASM_WEAKEN_LABEL (STREAM, NAME);                 \
+      if (VALUE)                                       \
+        ASM_OUTPUT_DEF (STREAM, NAME, VALUE);          \
+    }                                                  \
+  while (0)
+#endif
+
 /* This determines whether or not we support weak symbols.  */
 #ifndef SUPPORTS_WEAK
 #ifdef ASM_WEAKEN_LABEL
index adf9870789cf988ee75555250622dbdcd3751185..6fcc3ba8a47db1cc85acdbf3075325185f8e20e1 100644 (file)
@@ -6423,7 +6423,8 @@ correct for most systems.
 @item ASM_OUTPUT_WEAK_ALIAS (@var{stream}, @var{name}, @var{value})
 A C statement to output to the stdio stream @var{stream} assembler code
 which defines (equates) the weak symbol @var{name} to have the value
-@var{value}.
+@var{value}.  If @var{value} is @code{NULL}, it defines @var{name} as
+an undefined weak symbol.
 
 Define this macro if the target only supports weak aliases; define
 @code{ASM_OUTPUT_DEF} instead if possible.
index 8d7000c9dd94f8b5c8c3f1d4be1808d346223092..76f1c675792955c753a891d771841e87e6565b0e 100644 (file)
@@ -4773,11 +4773,7 @@ weak_finish ()
       for (t = weak_decls; t; t = t->next)
        {
          if (t->name)
-           {
-             ASM_WEAKEN_LABEL (asm_out_file, t->name);
-             if (t->value)
-               ASM_OUTPUT_DEF (asm_out_file, t->name, t->value);
-           }
+           ASM_OUTPUT_WEAK_ALIAS (asm_out_file, t->name, t->value);
        }
     }
 #endif