This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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]

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


An asm source such as:

.weakref foo, bar
.weakref .foo, .bar

should not have any entries in the symbol table, but what we were
getting was a strong undef for .bar.  After fixing that, and adding:

bl .foo

I noticed that .bar made it to the symbol table as weak, but bar
didn't make it at all, contrary to the intent of the code I'd just
tweaked, so I narrowed the condition used to drop weakrefd symbols
such that both bar and .bar would make it as weak symbols.

Ok to install?  Tested on amd64-linux-gnu-x-ppc64-linux-gnu.

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-ppc.c (ppc_frob_file_before_adjust): Do not reference
	dotname.
	* write.c (write_object_file): Do not remove used weakrefd.

Index: gas/config/tc-ppc.c
===================================================================
--- gas/config/tc-ppc.c.orig	2005-11-17 00:59:48.000000000 -0200
+++ gas/config/tc-ppc.c	2005-11-17 01:08:04.000000000 -0200
@@ -1931,7 +1931,7 @@
       dotname = xmalloc (len + 1);
       dotname[0] = '.';
       memcpy (dotname + 1, name, len);
-      dotsym = symbol_find (dotname);
+      dotsym = symbol_find_noref (dotname, 1);
       free (dotname);
       if (dotsym != NULL && (symbol_used_p (dotsym)
 			     || symbol_used_in_reloc_p (dotsym)))
Index: gas/write.c
===================================================================
--- gas/write.c.orig	2005-11-17 00:59:48.000000000 -0200
+++ gas/write.c	2005-11-17 01:08:04.000000000 -0200
@@ -1513,7 +1513,8 @@
 		 opposites.  Sometimes the former checks flags and the
 		 latter examines the name...  */
 	      || (!S_IS_EXTERNAL (symp)
-		  && (punt || S_IS_LOCAL (symp) || S_IS_WEAKREFD (symp))
+		  && (punt || S_IS_LOCAL (symp) ||
+		      (S_IS_WEAKREFD (symp) && ! symbol_used_p (symp)))
 		  && ! symbol_used_in_reloc_p (symp)))
 	    {
 	      symbol_remove (symp, &symbol_rootP, &symbol_lastP);

-- 
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]