diff options
author | Will Newton <will.newton@linaro.org> | 2014-06-16 15:49:07 +0100 |
---|---|---|
committer | Will Newton <will.newton@linaro.org> | 2014-06-16 15:51:21 +0100 |
commit | 9f19ab6dfa13c3971423624d18f20d90ab70c9cc (patch) | |
tree | 6ad062f4a16eaff590078a0c2d11a9505a7e0ad1 /bfd/elf32-arm.c | |
parent | d03de42190b3b55fb195340dde8e595714a35090 (diff) | |
download | gdb-9f19ab6dfa13c3971423624d18f20d90ab70c9cc.zip gdb-9f19ab6dfa13c3971423624d18f20d90ab70c9cc.tar.gz gdb-9f19ab6dfa13c3971423624d18f20d90ab70c9cc.tar.bz2 |
ld/ARM: Fix IFUNC and TLS descriptors in the same shared object
Combining TLS descriptors and GNU indirect functions in the same
object could lead to assertions or multiple dynamic relocations
for the same GOT slot. Fix the bookkeeping so this doesn't happen.
This allows building and make checking glibc with -mtls-dialect=gnu2.
bfd/ChangeLog:
2014-06-16 Will Newton <will.newton@linaro.org>
* elf32-arm.c (elf32_arm_allocate_plt_entry): Increment
htab->next_tls_desc_index in the non-IPLT case.
Calculate GOT offset correctly for the non-IPLT case.
(allocate_dynrelocs_for_symbol): Don't increment
htab->next_tls_desc_index here.
ld/testsuite/ChangeLog:
2014-06-16 Will Newton <will.newton@linaro.org>
* ld-arm/arm-elf.exp: Add ifunc-gdesc test.
* ld-arm/ifunc-gdesc.r: New file.
* ld-arm/ifunc-gdesc.s: Likewise.
* ld-arm/ifunc-gdesc.ver: Likewise.
Diffstat (limited to 'bfd/elf32-arm.c')
-rw-r--r-- | bfd/elf32-arm.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bfd/elf32-arm.c b/bfd/elf32-arm.c index ef8bfa6..ca64c7b 100644 --- a/bfd/elf32-arm.c +++ b/bfd/elf32-arm.c @@ -7522,6 +7522,8 @@ elf32_arm_allocate_plt_entry (struct bfd_link_info *info, first entry. */ if (splt->size == 0) splt->size += htab->plt_header_size; + + htab->next_tls_desc_index++; } /* Allocate the PLT entry itself, including any leading Thumb stub. */ @@ -7534,7 +7536,10 @@ elf32_arm_allocate_plt_entry (struct bfd_link_info *info, { /* We also need to make an entry in the .got.plt section, which will be placed in the .got section by the linker script. */ - arm_plt->got_offset = sgotplt->size - 8 * htab->num_tls_desc; + if (is_iplt_entry) + arm_plt->got_offset = sgotplt->size; + else + arm_plt->got_offset = sgotplt->size - 8 * htab->num_tls_desc; sgotplt->size += 4; } } @@ -13360,8 +13365,6 @@ allocate_dynrelocs_for_symbol (struct elf_link_hash_entry *h, void * inf) h->target_internal = ST_BRANCH_TO_ARM; } - htab->next_tls_desc_index++; - /* VxWorks executables have a second set of relocations for each PLT entry. They go in a separate relocation section, which is processed by the kernel loader. */ |