PATCH: PR ld/975: [Regression]: ld -pie generates DT_TEXTREL

H. J. Lu hjl@lucon.org
Mon Jul 11 19:27:00 GMT 2005


On Mon, Jul 11, 2005 at 08:52:54PM +0930, Alan Modra wrote:
> On Fri, May 27, 2005 at 05:15:18PM -0700, H. J. Lu wrote:
> > 	PR 975
> > 	* elflink.c (_bfd_elf_symbol_refs_local_p): Only undefined
> > 	symbol with default visibility is local.
> 
> This patch causes testsuite failures.  On powerpc-linux, I see
> 
> FAIL: visibility (hidden_undef) (non PIC)
> FAIL: visibility (hidden_undef) (non PIC, load offset)
> FAIL: visibility (hidden_undef) (PIC main, non PIC so)
> FAIL: visibility (protected_undef) (non PIC)
> FAIL: visibility (protected_undef) (non PIC, load offset)
> FAIL: visibility (protected_undef) (PIC main, non PIC so)
> 
> You changed the meaning of _bfd_elf_symbol_refs_local_p, and I didn't
> see any approval for the change.  Please revert.
> 

I reverted it. Here is the updated patch. Does it work ppc?


H.J.
----
2005-07-11  H.J. Lu  <hongjiu.lu@intel.com>

	PR 975
	* elflink.c (_bfd_elf_symbol_refs_local_p): Only undefined
	symbol with non-hidden/internal visibility is local.

--- bfd/elflink.c.vsb	2005-07-11 11:02:26.000000000 -0700
+++ bfd/elflink.c	2005-07-11 12:22:55.254800918 -0700
@@ -2572,8 +2572,11 @@ _bfd_elf_symbol_refs_local_p (struct elf
   if (ELF_COMMON_DEF_P (h))
     /* Do nothing.  */;
   /* If we don't have a definition in a regular file, then we can't
-     resolve locally.  The sym is either undefined or dynamic.  */
-  else if (!h->def_regular)
+     resolve locally unless it has hidden or internal visibility.  The
+     sym is either undefined or dynamic.  */
+  else if (!h->def_regular
+	   && ELF_ST_VISIBILITY (h->other) != STV_HIDDEN
+	   && ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
     return FALSE;
 
   /* Forced local symbols resolve locally.  */



More information about the Binutils mailing list