This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: PATCH: PR ld/975: [Regression]: ld -pie generates DT_TEXTREL
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: "H. J. Lu" <hjl at lucon dot org>
- Cc: binutils at sources dot redhat dot com
- Date: Tue, 12 Jul 2005 09:18:06 +0930
- Subject: Re: PATCH: PR ld/975: [Regression]: ld -pie generates DT_TEXTREL
- References: <20050527230900.GA1191@lucon.org> <20050528001518.GA2251@lucon.org> <20050711112254.GG30960@bubble.grove.modra.org> <20050711192709.GA2979@lucon.org>
On Mon, Jul 11, 2005 at 12:27:09PM -0700, H. J. Lu wrote:
> I reverted it. Here is the updated patch. Does it work ppc?
No, you are still changing the meaning of the function.
_bfd_elf_symbol_refs_local_p says:
/* Return true if the symbol referred to by H should be considered
to resolve local to the current module, and false otherwise. Differs
from (the inverse of) _bfd_elf_dynamic_symbol_p in the treatment of
undefined symbols and weak symbols. */
ie. the function should only return true for *resolved* symbols.
elf32-ppc.c uses this when generating dynamic relocations as follows:
if (skip)
memset (&outrel, 0, sizeof outrel);
else if (!SYMBOL_REFERENCES_LOCAL (info, h))
{
unresolved_reloc = FALSE;
outrel.r_info = ELF32_R_INFO (h->dynindx, r_type);
outrel.r_addend = rel->r_addend;
}
else
{
code to output relative relocs and relocs against
section syms..
}
With your change, the last block bombs when it gets an undefined sym.
> --- 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. */
--
Alan Modra
IBM OzLabs - Linux Technology Centre