aboutsummaryrefslogtreecommitdiff
path: root/ld/testsuite/ld-cris/tls-gd-1.d
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2019-07-11 22:08:39 +0930
committerAlan Modra <amodra@gmail.com>2019-07-13 09:57:50 +0930
commitf26a32876ba49b2d5537beccea2a38bc544e9732 (patch)
treed336701d832c5984d9027a6b371e9acc7c6eb772 /ld/testsuite/ld-cris/tls-gd-1.d
parent7b2438015ca87297b2796c662182f796bb5358c2 (diff)
downloadgdb-f26a32876ba49b2d5537beccea2a38bc544e9732.zip
gdb-f26a32876ba49b2d5537beccea2a38bc544e9732.tar.gz
gdb-f26a32876ba49b2d5537beccea2a38bc544e9732.tar.bz2
Dynamic TLS section symbols
It is possible to create shared libraries on PowerPC using -ftls-model=inital-exec or -ftls-model=local-exec. The first is half reasonable, getting you a shared library that can't be dlopen'd but otherwise is reasonable. The second is quite bad. Not only do you lose being able to dlopen, the library also has dynamic text relocations. Worse, the TPREL16_LO, TPREL16_HA and other TPREL16 dynamic relocs emitted were wrong, resulting in wrong values being applied by ld.so. Using the first TLS section symbol in dynamic relocations for local TLS symbols doesn't work. It's wrong because TLS symbols used by TLS relocs have values relative to the TLS segment, whereas the TLS section symbols are addresses. This patch instead uses a symbol index of zero which is used elsewhere by PowerPC on dynamic TLS relocs. It's not strictly ABI compliant to use a non-TLS symbol with TLS relocs but symbol index zero can be interpreted as "no symbol". Not using the first TLS section symbol means it doesn't need to be dynamic. The patch also fixes a further problem with PowerPC32 dynamic TPREL16* relocs, which shouldn't have the symbol value in the addend as we do for non-TLS symbols. bfd/ * elflink.c (_bfd_elf_omit_section_dynsym_default): Don't keep tls_sec. (_bfd_elf_init_1_index_section): Prefer not using TLS sections. (_bfd_elf_init_2_index_sections): Likewise. * elf64-ppc.c (ppc64_elf_relocate_section): When emitting dynamic relocations for local TLS symbols, use STN_UNDEF as the relocation symbol. * elf32-ppc.c (ppc_elf_relocate_section): Likewise, and don't leave TLS symbol value in the addend. ld/ * testsuite/ld-powerpc/tlsso.r: Update. * testsuite/ld-powerpc/tlsso32.g: Update. * testsuite/ld-powerpc/tlsso32.r: Update. * testsuite/ld-powerpc/tlstocso.r: Update. * testsuite/ld-cris/tls-dso-dtpoffd2.d: Update. * testsuite/ld-cris/tls-dso-dtpoffd4.d: Update. * testsuite/ld-cris/tls-dso-tpoffgotcomm1.d: Update. * testsuite/ld-cris/tls-gd-1.d: Update. * testsuite/ld-cris/tls-gd-1h.d: Update. * testsuite/ld-cris/tls-gd-2.d: Update. * testsuite/ld-cris/tls-gd-2h.d: Update. * testsuite/ld-cris/tls-ie-10.d: Update. * testsuite/ld-cris/tls-ie-11.d: Update. * testsuite/ld-cris/tls-ie-8.d: Update. * testsuite/ld-cris/tls-ie-9.d: Update. * testsuite/ld-cris/tls-js1.d: Update. * testsuite/ld-cris/tls-ld-4.d: Update. * testsuite/ld-cris/tls-ld-5.d: Update. * testsuite/ld-cris/tls-ld-6.d: Update. * testsuite/ld-cris/tls-ld-7.d: Update. * testsuite/ld-cris/tls-ldgd-14.d: Update. * testsuite/ld-cris/tls-ldgd-15.d: Update. * testsuite/ld-cris/tls-ldgdx-14.d: Update. * testsuite/ld-cris/tls-ldgdx-15.d: Update. * testsuite/ld-cris/tls-local-54.d: Update. * testsuite/ld-cris/tls-local-60.d: Update. * testsuite/ld-cris/tls-local-61.d: Update. * testsuite/ld-cris/tls-local-63.d: Update. * testsuite/ld-cris/tls-local-64.d: Update. * testsuite/ld-cris/tls-ok-30.d: Update. * testsuite/ld-cris/tls-ok-32.d: Update. * testsuite/ld-cris/tls-ok-34.d: Update. * testsuite/ld-mips-elf/tls-multi-got-1.got: Update. * testsuite/ld-mips-elf/tls-multi-got-1.r: Update. * testsuite/ld-mips-elf/tlsdyn-pie-o32.d: Update. * testsuite/ld-mips-elf/tlsdyn-pie-o32.got: Update. * testsuite/ld-mips-elf/tlslib-o32-hidden.got: Update. * testsuite/ld-mips-elf/tlslib-o32-ver.got: Update. * testsuite/ld-mips-elf/tlslib-o32.got: Update. * testsuite/ld-s390/tlspic.rd: Update. * testsuite/ld-s390/tlspic_64.rd: Update. * testsuite/ld-sparc/tlssunnopic32.rd: Update. * testsuite/ld-sparc/tlssunnopic64.rd: Update. * testsuite/ld-sparc/tlssunpic32.rd: Update. * testsuite/ld-sparc/tlssunpic64.rd: Update.
Diffstat (limited to 'ld/testsuite/ld-cris/tls-gd-1.d')
-rw-r--r--ld/testsuite/ld-cris/tls-gd-1.d22
1 files changed, 11 insertions, 11 deletions
diff --git a/ld/testsuite/ld-cris/tls-gd-1.d b/ld/testsuite/ld-cris/tls-gd-1.d
index 30ab7ef..4fbd79c 100644
--- a/ld/testsuite/ld-cris/tls-gd-1.d
+++ b/ld/testsuite/ld-cris/tls-gd-1.d
@@ -12,21 +12,21 @@
Program Header:
LOAD off 0x0+ vaddr 0x0+ paddr 0x0+ align 2\*\*13
- filesz 0x0+144 memsz 0x0+144 flags r-x
- LOAD off 0x0+144 vaddr 0x0+2144 paddr 0x0+2144 align 2\*\*13
+ filesz 0x0+130 memsz 0x0+130 flags r-x
+ LOAD off 0x0+130 vaddr 0x0+2130 paddr 0x0+2130 align 2\*\*13
filesz 0x0+108 memsz 0x0+108 flags rw-
- DYNAMIC off 0x0+1c8 vaddr 0x0+21c8 paddr 0x0+21c8 align 2\*\*2
+ DYNAMIC off 0x0+1b4 vaddr 0x0+21b4 paddr 0x0+21b4 align 2\*\*2
filesz 0x0+70 memsz 0x0+70 flags rw-
- TLS off 0x0+144 vaddr 0x0+2144 paddr 0x0+2144 align 2\*\*2
+ TLS off 0x0+130 vaddr 0x0+2130 paddr 0x0+2130 align 2\*\*2
filesz 0x0+84 memsz 0x0+84 flags r--
Dynamic Section:
HASH 0x0+b4
- STRTAB 0x0+124
- SYMTAB 0x0+d4
+ STRTAB 0x0+110
+ SYMTAB 0x0+d0
STRSZ 0x0+d
SYMENT 0x0+10
- RELA 0x0+134
+ RELA 0x0+120
RELASZ 0x0+c
RELAENT 0x0+c
private flags = 0:
@@ -42,13 +42,13 @@ DYNAMIC SYMBOL TABLE:
DYNAMIC RELOCATION RECORDS
OFFSET TYPE VALUE
-0+2244 R_CRIS_DTP x
+0+2230 R_CRIS_DTP x
Contents of section \.hash:
#...
Contents of section \.text:
- 0140 5fae0c00 .*
+ 012c 5fae0c00 .*
#...
Contents of section \.got:
- 2238 c8210+ 0+ 0+ 0+ .*
- 2248 0+ .*
+ 2224 b4210+ 0+ 0+ 0+ .*
+ 2234 0+ .*