This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, RFC] weakref error with ppc -m64 -mcall-aixdesc


On Nov 17, 2005, Richard Henderson <rth@redhat.com> wrote:

> On Thu, Nov 17, 2005 at 01:14:45AM -0200, Alexandre Oliva wrote:
>> * config/rs6000/rs6000.h (ASM_OUTPUT_WEAKREF): Define.
>> (ASM_WEAKEN_LABEL): Do not 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_WEKAREF): Document it.

> Ok.

Thanks, I've checked the patch in with the revised ChangeLog entry
below.

Index: gcc/ChangeLog
from  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.

Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h	(revision 107155)
+++ gcc/config/rs6000/rs6000.h	(working copy)
@@ -2033,6 +2033,26 @@
   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: gcc/defaults.h
===================================================================
--- gcc/defaults.h	(revision 107155)
+++ gcc/defaults.h	(working copy)
@@ -174,7 +174,7 @@
    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: gcc/doc/tm.texi
===================================================================
--- gcc/doc/tm.texi	(revision 107155)
+++ gcc/doc/tm.texi	(working copy)
@@ -6766,6 +6766,12 @@
 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: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 107155)
+++ gcc/varasm.c	(working copy)
@@ -4551,7 +4551,10 @@
 #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 @@
 	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
-- 
Alexandre Oliva         http://www.lsd.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer   aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist  oliva@{lsd.ic.unicamp.br, gnu.org}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]