This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] Fix ppc64_elf_adjust_dynamic_symbol
On Mon, May 07, 2007 at 12:32:35PM +0930, Alan Modra wrote:
> On Sun, May 06, 2007 at 09:30:52PM +0200, Jakub Jelinek wrote:
> > Looking many other backends the if (h->type == STT_FUNC || h->needs_plt)
> > block always ends with return TRUE, except in elf64-ppc.c.
> > Is there any reason for that?
>
> Did you try running the ld testsuite natively after applying your
> patch? :-) Yes, there is good reason. We might need copy relocs
> (or at least get to the ELIMINATE_COPY_RELOCS code so that we clear
> non_got_ref and generate a dyn reloc) for function descriptors, which
> are STT_FUNC.
Oops, you're right, shouldn't have looked at it on Sunday night.
With the following patch (wonder whether just if (h->def_regular) wouldn't
be enough too) I get no ppc64 native testsuite regressions and the weirdo
ocaml testcase passes too.
2007-05-07 Jakub Jelinek <jakub@redhat.com>
* elf64-ppc.c (ppc64_elf_adjust_dynamic_symbol): Don't do copyreloc
processing if symbol is defined in the executable.
--- bfd/elf64-ppc.c.jj 2007-05-06 17:53:09.000000000 +0200
+++ bfd/elf64-ppc.c 2007-05-07 08:41:37.000000000 +0200
@@ -5851,6 +5851,10 @@ ppc64_elf_adjust_dynamic_symbol (struct
if (!h->non_got_ref)
return TRUE;
+ /* Don't generate a copy reloc for symbols defined in the executable. */
+ if (!h->def_dynamic || !h->ref_regular || h->def_regular)
+ return TRUE;
+
if (ELIMINATE_COPY_RELOCS)
{
struct ppc_link_hash_entry * eh;
Jakub