PPC32 TLS GD and LD force old GOT/PLT layout
Alan Modra
amodra@bigpond.net.au
Wed Mar 15 14:31:00 GMT 2006
On Thu, Mar 16, 2006 at 12:23:36AM +1030, Alan Modra wrote:
> * elf32-ppc.c (ppc_elf_check_relocs): Don't fall into REL24
> checks from REL32.
Sigh. That introduces an incompatibility between check_relocs
and gc_sweep_hook. Which might mean we miscount plt refcounts. Not
that any sane code should ever trigger the bug (you'd need a REL32
against a function sym in a shared lib), but I like to keep things tidy.
Rather than tweaking gc_sweep_hook, I think I prefer to make
check_relocs treat REL32 as it did before I added the tests for old gcc
-fpic and -fPIC code. Oh, and I see there was already a similar
incompatibility in the REL24 and REL14 accounting. Fix that too.
* elf32-ppc.c (ppc_elf_check_relocs): REL24 and REL14 relocs
against __GLOBAL_OFFSET_TABLE__ need never be dynamic. Tweak
last change to REL32 relocs so that they are counted as
possibly dynamic as per REL24 and REL14.
Index: bfd/elf32-ppc.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-ppc.c,v
retrieving revision 1.193
diff -u -p -r1.193 elf32-ppc.c
--- bfd/elf32-ppc.c 15 Mar 2006 13:52:58 -0000 1.193
+++ bfd/elf32-ppc.c 15 Mar 2006 14:16:41 -0000
@@ -3335,9 +3335,9 @@ ppc_elf_check_relocs (bfd *abfd,
if (s == got2)
htab->plt_type = PLT_OLD;
}
- if (h == NULL)
+ if (h == NULL || h == htab->elf.hgot)
break;
- goto dodyn;
+ goto dodyn1;
case R_PPC_REL24:
case R_PPC_REL14:
@@ -3345,9 +3345,10 @@ ppc_elf_check_relocs (bfd *abfd,
case R_PPC_REL14_BRNTAKEN:
if (h == NULL)
break;
- if (h == htab->elf.hgot && htab->plt_type == PLT_UNSET)
+ if (h == htab->elf.hgot)
{
- htab->plt_type = PLT_OLD;
+ if (htab->plt_type == PLT_UNSET)
+ htab->plt_type = PLT_OLD;
break;
}
/* fall through */
@@ -3363,6 +3364,7 @@ ppc_elf_check_relocs (bfd *abfd,
case R_PPC_ADDR14_BRNTAKEN:
case R_PPC_UADDR32:
case R_PPC_UADDR16:
+ dodyn1:
if (h != NULL && !info->shared)
{
/* We may need a plt entry if the symbol turns out to be
--
Alan Modra
IBM OzLabs - Linux Technology Centre
More information about the Binutils
mailing list