diff options
author | Faraz Shahbazker <fshahbazker@wavecomp.com> | 2019-05-18 01:19:04 -0700 |
---|---|---|
committer | Faraz Shahbazker <fshahbazker@wavecomp.com> | 2019-05-21 11:55:08 -0700 |
commit | b474a2022dc14fea0dd8ea4cc66b813486132075 (patch) | |
tree | 0fe5db1c7c9c7dbe2899109aec52a5f63d624539 /bfd | |
parent | 304f09d0d4b519f143144d213e1280a0691de8ba (diff) | |
download | gdb-b474a2022dc14fea0dd8ea4cc66b813486132075.zip gdb-b474a2022dc14fea0dd8ea4cc66b813486132075.tar.gz gdb-b474a2022dc14fea0dd8ea4cc66b813486132075.tar.bz2 |
MIPS/LD: Reject tprel_hi and tprel_lo relocations in shared library
bfd/
* elfxx-mips.c (_bfd_mips_elf_check_relocs): Generate error
for TLS_TPREL_HI16(/LO16) relocations in shared library.
ld/
* testsuite/ld-mips-elf/pic-reloc-5.s: Add tests for
%tprel_hi and %tprel_lo relocations.
* testsuite/ld-mips-elf/pic-reloc-6.s: Likewise.
* testsuite/ld-mips-elf/pic-reloc-5.d: Update accordingly.
* testsuite/ld-mips-elf/pic-reloc-6.d: Likewise.
* testsuite/ld-mips-elf/pic-reloc-tls.ld: New test linker
script file.
Diffstat (limited to 'bfd')
-rw-r--r-- | bfd/ChangeLog | 5 | ||||
-rw-r--r-- | bfd/elfxx-mips.c | 12 |
2 files changed, 17 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 4335227..320e06a 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,5 +1,10 @@ 2019-05-21 Faraz Shahbazker <fshahbazker@wavecomp.com> + * elfxx-mips.c (_bfd_mips_elf_check_relocs): Generate error + for TLS_TPREL_HI16(/LO16) relocations in shared library. + +2019-05-21 Faraz Shahbazker <fshahbazker@wavecomp.com> + * elfxx-mips.c (_bfd_mips_elf_check_relocs): Add NULL pointer checks. Search the RELA table for n64 relocations. diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c index 28e95bc..c64f90c 100644 --- a/bfd/elfxx-mips.c +++ b/bfd/elfxx-mips.c @@ -9102,6 +9102,18 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info, { switch (r_type) { + case R_MIPS_TLS_TPREL_HI16: + case R_MIPS16_TLS_TPREL_HI16: + case R_MICROMIPS_TLS_TPREL_HI16: + case R_MIPS_TLS_TPREL_LO16: + case R_MIPS16_TLS_TPREL_LO16: + case R_MICROMIPS_TLS_TPREL_LO16: + /* These are okay in PIE, but not in a shared library. */ + if (bfd_link_executable (info)) + break; + + /* FALLTHROUGH */ + case R_MIPS16_HI16: case R_MIPS_HI16: case R_MIPS_HIGHER: |