mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
f26a32876b
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.
54 lines
1.4 KiB
Makefile
54 lines
1.4 KiB
Makefile
.*: file format elf32-tradbigmips
|
|
|
|
Disassembly of section \.text:
|
|
|
|
.* <__start>:
|
|
.*: 3c1c0fc0 lui gp,0xfc0
|
|
.*: 279c7be0 addiu gp,gp,31712
|
|
.*: 0399e021 addu gp,gp,t9
|
|
.*: 27bdfff0 addiu sp,sp,-16
|
|
.*: afbe0008 sw s8,8\(sp\)
|
|
.*: 03a0f025 move s8,sp
|
|
.*: afbc0000 sw gp,0\(sp\)
|
|
.*: 8f998018 lw t9,-32744\(gp\)
|
|
.*: 27848034 addiu a0,gp,-32716
|
|
.*: 0320f809 jalr t9
|
|
.*: 00000000 nop
|
|
.*: 8fdc0000 lw gp,0\(s8\)
|
|
.*: 00000000 nop
|
|
.*: 8f998018 lw t9,-32744\(gp\)
|
|
.*: 27848020 addiu a0,gp,-32736
|
|
.*: 0320f809 jalr t9
|
|
.*: 00000000 nop
|
|
.*: 8fdc0000 lw gp,0\(s8\)
|
|
.*: 00000000 nop
|
|
.*: 8f998018 lw t9,-32744\(gp\)
|
|
.*: 27848028 addiu a0,gp,-32728
|
|
.*: 0320f809 jalr t9
|
|
.*: 00000000 nop
|
|
.*: 8fdc0000 lw gp,0\(s8\)
|
|
.*: 00401025 move v0,v0
|
|
.*: 3c030000 lui v1,0x0
|
|
.*: 24638000 addiu v1,v1,-32768
|
|
.*: 00621821 addu v1,v1,v0
|
|
.*: 7c02283b rdhwr v0,\$5
|
|
.*: 8f83801c lw v1,-32740\(gp\)
|
|
.*: 00000000 nop
|
|
.*: 00621821 addu v1,v1,v0
|
|
.*: 8f838030 lw v1,-32720\(gp\)
|
|
.*: 00000000 nop
|
|
.*: 00621821 addu v1,v1,v0
|
|
.*: 7c02283b rdhwr v0,\$5
|
|
.*: 3c030000 lui v1,0x0
|
|
.*: 24639004 addiu v1,v1,-28668
|
|
.*: 00621821 addu v1,v1,v0
|
|
.*: 03c0e825 move sp,s8
|
|
.*: 8fbe0008 lw s8,8\(sp\)
|
|
.*: 03e00008 jr ra
|
|
.*: 27bd0010 addiu sp,sp,16
|
|
|
|
.* <__tls_get_addr>:
|
|
.*: 03e00008 jr ra
|
|
.*: 00000000 nop
|
|
\.\.\.
|