rs6000.h (ASM_OUTPUT_WEAKREF): Define.
authorAlexandre Oliva <aoliva@redhat.com>
Fri, 18 Nov 2005 01:55:34 +0000 (01:55 +0000)
committerAlexandre Oliva <aoliva@gcc.gnu.org>
Fri, 18 Nov 2005 01:55:34 +0000 (01:55 +0000)
* config/rs6000/rs6000.h (ASM_OUTPUT_WEAKREF): Define.
* defaults.h (ASM_OUTPUT_WEAKREF): Add decl argument.
* varasm.c (do_assemble_alias): Adjust call.
(weak_finish): Don't use ASM_WEAKEN_LABEL if ASM_WEAKEN_DECL
is defined.
* doc/tm.texi (ASM_OUTPUT_WEAKREF): Document it.

From-SVN: r107156

gcc/ChangeLog
gcc/config/rs6000/rs6000.h
gcc/defaults.h
gcc/doc/tm.texi
gcc/varasm.c

index 1f7394e278c90786c95c218f2407b50c168fc59e..22a6b70aed20a3f982680f43214590b508018d72 100644 (file)
@@ -1,3 +1,12 @@
+2005-11-17  Alexandre Oliva  <aoliva@redhat.com>
+
+       * config/rs6000/rs6000.h (ASM_OUTPUT_WEAKREF): Define.
+       * defaults.h (ASM_OUTPUT_WEAKREF): Add decl argument.
+       * varasm.c (do_assemble_alias): Adjust call.
+       (weak_finish): Don't use ASM_WEAKEN_LABEL if ASM_WEAKEN_DECL
+       is defined.
+       * doc/tm.texi (ASM_OUTPUT_WEAKREF): Document it.
+
 2005-11-17  James E Wilson  <wilson@specifix.com>
 
        * tree.def (FUNCTION_DECL): Correct typo in comment.
index d3b3eea0557682f6acbfa1be611642583000bb67..d2b54916003dd9ea4bf95c07c20fc396d71189c2 100644 (file)
@@ -2033,6 +2033,26 @@ extern int toc_initialized;
   while (0)
 #endif
 
+#if HAVE_GAS_WEAKREF
+#define ASM_OUTPUT_WEAKREF(FILE, DECL, NAME, VALUE)                    \
+  do                                                                   \
+    {                                                                  \
+      fputs ("\t.weakref\t", (FILE));                                  \
+      RS6000_OUTPUT_BASENAME ((FILE), (NAME));                                 \
+      fputs (", ", (FILE));                                            \
+      RS6000_OUTPUT_BASENAME ((FILE), (VALUE));                                \
+      if ((DECL) && TREE_CODE (DECL) == FUNCTION_DECL                  \
+         && DEFAULT_ABI == ABI_AIX && DOT_SYMBOLS)                     \
+       {                                                               \
+         fputs ("\n\t.weakref\t.", (FILE));                            \
+         RS6000_OUTPUT_BASENAME ((FILE), (NAME));                      \
+         fputs (", .", (FILE));                                        \
+         RS6000_OUTPUT_BASENAME ((FILE), (VALUE));                     \
+       }                                                               \
+      fputc ('\n', (FILE));                                            \
+    } while (0)
+#endif
+
 /* This implements the `alias' attribute.  */
 #undef ASM_OUTPUT_DEF_FROM_DECLS
 #define        ASM_OUTPUT_DEF_FROM_DECLS(FILE, DECL, TARGET)                   \
index 9d82960e9876a07ec40ce148803ebdbebc5189b2..38dab339e341b58af4d8e6870ee53224c6edab76 100644 (file)
@@ -174,7 +174,7 @@ Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA
    the latter is referenced directly, a strong reference prevails.  */
 #ifndef ASM_OUTPUT_WEAKREF
 #if defined HAVE_GAS_WEAKREF
-#define ASM_OUTPUT_WEAKREF(FILE, NAME, VALUE)                          \
+#define ASM_OUTPUT_WEAKREF(FILE, DECL, NAME, VALUE)                    \
   do                                                                   \
     {                                                                  \
       fprintf ((FILE), "\t.weakref\t");                                        \
index b229ee823ddc4f84afc146e4f9a0290aa59defa0..09279ec7af5c1e9975f46b1aff5c3ffe51b49e9a 100644 (file)
@@ -6766,6 +6766,12 @@ defines (equates) the weak symbol @var{name} to have the value
 to make @var{name} weak.
 @end defmac
 
+@defmac ASM_OUTPUT_WEAKREF (@var{stream}, @var{decl}, @var{name}, @var{value})
+Outputs a directive that enables @var{name} to be used to refer to
+symbol @var{value} with weak-symbol semantics.  @code{decl} is the
+declaration of @code{name}.
+@end defmac
+
 @defmac SUPPORTS_WEAK
 A C expression which evaluates to true if the target supports weak symbols.
 
index ad4d060a29faf1ab3e9a44c1fd524a35472b463d..68a46eab5e2963f9e18af6a96d1c5ab3cdf9cdee 100644 (file)
@@ -4551,7 +4551,10 @@ weak_finish (void)
 #ifndef ASM_OUTPUT_WEAKREF
       else if (! TREE_SYMBOL_REFERENCED (target))
        {
-# ifdef ASM_WEAKEN_LABEL
+         /* Use ASM_WEAKEN_LABEL only if ASM_WEAKEN_DECL is not
+            defined, otherwise we and weak_finish_1 would use a
+            different macros.  */
+# if defined ASM_WEAKEN_LABEL && ! defined ASM_WEAKEN_DECL
          ASM_WEAKEN_LABEL (asm_out_file, IDENTIFIER_POINTER (target));
 # else
          tree decl = find_decl_and_mark_needed (alias_decl, target);
@@ -4736,7 +4739,7 @@ do_assemble_alias (tree decl, tree target)
        weakref_targets = tree_cons (decl, target, weakref_targets);
 
 #ifdef ASM_OUTPUT_WEAKREF
-      ASM_OUTPUT_WEAKREF (asm_out_file,
+      ASM_OUTPUT_WEAKREF (asm_out_file, decl,
                          IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)),
                          IDENTIFIER_POINTER (target));
 #else