powerpc64 dot-sym fix

Alan Modra amodra@bigpond.net.au
Thu Jun 2 13:13:00 GMT 2005
A bug introduced 2005-02-06 that escaped my notice because the newly
built ld wasn't being tested.  gcc -Btmpdir/ld/ doesn't always work.
See http://gcc.gnu.org/ml/gcc-patches/2005-06/msg00143.html

	* elf64-ppc.c (add_symbol_adjust): Set sym visibility to most
	restrictive of func code and func descr for undefined syms as well
	as defined.

Daniel, is this too late to go on the branch?

Index: bfd/elf64-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf64-ppc.c,v
retrieving revision 1.207
diff -u -p -r1.207 elf64-ppc.c
--- bfd/elf64-ppc.c	19 May 2005 08:26:54 -0000	1.207
+++ bfd/elf64-ppc.c	2 Jun 2005 13:08:59 -0000
@@ -4159,9 +4159,7 @@ add_symbol_adjust (struct elf_link_hash_
       else
 	fdh->elf.ref_regular = 1;
     }
-  else if (fdh != NULL
-	   && (fdh->elf.root.type == bfd_link_hash_defined
-	       || fdh->elf.root.type == bfd_link_hash_defweak))
+  else if (fdh != NULL)
     {
       unsigned entry_vis = ELF_ST_VISIBILITY (eh->elf.other) - 1;
       unsigned descr_vis = ELF_ST_VISIBILITY (fdh->elf.other) - 1;
@@ -4170,7 +4168,9 @@ add_symbol_adjust (struct elf_link_hash_
       else if (entry_vis > descr_vis)
 	eh->elf.other += descr_vis - entry_vis;
 
-      if (eh->elf.root.type == bfd_link_hash_undefined)
+      if ((fdh->elf.root.type == bfd_link_hash_defined
+	   || fdh->elf.root.type == bfd_link_hash_defweak)
+	  && eh->elf.root.type == bfd_link_hash_undefined)
 	{
 	  eh->elf.root.type = bfd_link_hash_undefweak;
 	  eh->was_undefined = 1;

-- 
Alan Modra
IBM OzLabs - Linux Technology Centre



More information about the Binutils mailing list