rs6000.h (ASM_OUTPUT_DEF_FROM_DECLS): Handle DECL_WEAK for function descriptors.
authorDavid Edelsohn <edelsohn@gnu.org>
Sat, 15 Dec 2001 02:16:37 +0000 (02:16 +0000)
committerDavid Edelsohn <dje@gcc.gnu.org>
Sat, 15 Dec 2001 02:16:37 +0000 (21:16 -0500)
        * config/rs6000/rs6000.h (ASM_OUTPUT_DEF_FROM_DECLS): Handle
        DECL_WEAK for function descriptors.
        * config/rs6000/xcoff.h (HANDLE_PRAGMA_WEAK): Define if assembler
        weak support present.
        (ASM_WEAKEN_LABEL): Same.

From-SVN: r48027

gcc/ChangeLog
gcc/config/rs6000/rs6000.h
gcc/config/rs6000/xcoff.h

index 7dbcf88fe9e938591356b3d9bf85848df2010c45..cfa921d1c286111a6a02d0e5d0e00036d9dde1c2 100644 (file)
@@ -1,3 +1,11 @@
+2001-12-14  David Edelsohn  <edelsohn@gnu.org>
+
+       * config/rs6000/rs6000.h (ASM_OUTPUT_DEF_FROM_DECLS): Handle
+       DECL_WEAK for function descriptors.
+       * config/rs6000/xcoff.h (HANDLE_PRAGMA_WEAK): Define if assembler
+       weak support present.
+       (ASM_WEAKEN_LABEL): Same.
+
 2001-12-14  Kazu Hirata  <kazu@hxi.com>
 
        * config/h8300/h8300.md (anonymous pattern): Add a missing
index 627766ab55bdede37384bdf91124387c0a1d048d..b809d6b0baaf89d7f1171ee1a04b938663ae15c0 100644 (file)
@@ -2469,8 +2469,13 @@ extern int toc_initialized;
     }                                                                    \
 }
 
-/* This implementes the `alias' attribute.  */
+#ifdef HAVE_GAS_WEAK
+#define RS6000_WEAK 1
+#else
+#define RS6000_WEAK 0
+#endif
 
+/* This implementes the `alias' attribute.  */
 #define ASM_OUTPUT_DEF_FROM_DECLS(FILE,decl,target)    \
 do {                                                   \
   const char * alias = XSTR (XEXP (DECL_RTL (decl), 0), 0); \
@@ -2480,9 +2485,18 @@ do {                                                     \
     {                                                  \
       if (TREE_PUBLIC (decl))                          \
        {                                               \
-         fputs ("\t.globl .", FILE);                   \
-         assemble_name (FILE, alias);                  \
-         putc ('\n', FILE);                            \
+         if (RS6000_WEAK && DECL_WEAK (decl))          \
+           {                                           \
+             fputs ("\t.weak .", FILE);                \
+             assemble_name (FILE, alias);              \
+             putc ('\n', FILE);                        \
+           }                                           \
+         else                                          \
+           {                                           \
+             fputs ("\t.globl .", FILE);               \
+             assemble_name (FILE, alias);              \
+             putc ('\n', FILE);                        \
+           }                                           \
        }                                               \
       else                                             \
        {                                               \
index d5a6ff082a6f97c2667b2582d6430f5af175719a..890ec4aee305f7e41a9ee7a85bc0b6a66a31e780 100644 (file)
@@ -438,9 +438,6 @@ toc_section ()                                              \
         fprintf ((FILE), ",%d\n", (SIZE));             \
   } while (0)
 
-/* Used by definition of ASM_OUTPUT_DOUBLE_INT */
-#define DOUBLE_INT_ASM_OP "\t.llong "
-
 /* This says how to output an assembler line
    to define a local common symbol.
    Alignment cannot be specified, but we can try to maintain
@@ -454,9 +451,25 @@ toc_section ()                                             \
                xcoff_bss_section_name);                \
      } while (0)
 
+/* Output a weak symbol, if weak support present.  */
+#ifdef HAVE_GAS_WEAK
+#define HANDLE_PRAGMA_WEAK 1
+
+#define ASM_WEAKEN_LABEL(FILE, NAME)   \
+  do                                   \
+    {                                  \
+      fputs ("\t.weak ", (FILE));      \
+      assemble_name ((FILE), (NAME));  \
+      fputc ('\n', (FILE));            \
+    }                                  \
+  while (0)
+#endif /* HAVE_GAS_WEAK */
+
 /* This is how we tell the assembler that two symbols have the same value.  */
+#define SET_ASM_OP "\t.set "
 
-#define SET_ASM_OP "\t.set\t"
+/* Used by definition of ASM_OUTPUT_DOUBLE_INT */
+#define DOUBLE_INT_ASM_OP "\t.llong "
 
 /* These are various definitions for DWARF output.  They could just
    use '.long' or '.word', but that aligns to a 4-byte boundary which