diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2019-04-17 09:08:46 -0700 |
---|---|---|
committer | Andreas K. Hüttel <dilfridge@gentoo.org> | 2019-04-24 22:20:50 +0200 |
commit | de2ddc0f19ae30dabfad3cd9afa0c42e1c09759f (patch) | |
tree | 452d8a6b6182a1ef2f8a0ae46b799188c25a1c36 | |
parent | PR24041, Invalid Memory Address Dereference in elf_link_add_object_symbols (diff) | |
download | binutils-gdb-gentoo/binutils-2.31.1.tar.gz binutils-gdb-gentoo/binutils-2.31.1.tar.bz2 binutils-gdb-gentoo/binutils-2.31.1.zip |
x86: Also check x86 linker_def for non-shared definitiongentoo/binutils-2.31.1-7gentoo/binutils-2.31.1
Since elf_x86_linker_defined sets linker_def in elf_x86_link_hash_entry
for linker defined symbols, SYMBOL_DEFINED_NON_SHARED_P should also check
linker_def in elf_x86_link_hash_entry.
bfd/
PR ld/24458
* elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86
linker_def.
ld/
PR ld/24458
* testsuite/ld-x86-64/x86-64.exp: Run PR ld/24458 tests.
* testsuite/ld-x86-64/pr24458.s: New file.
* testsuite/ld-x86-64/pr24458a-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458a.d: Likewise.
* testsuite/ld-x86-64/pr24458b-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458b.d: Likewise.
* testsuite/ld-x86-64/pr24458c-x32.d: Likewise.
* testsuite/ld-x86-64/pr24458c.d: Likewise.
(cherry picked from commit 4e84a8f8bbeab52fa7048873655e582ceb92534d)
(cherry picked from commit bca6a14c568bd63080c85a6b05c90996e2bd4a34)
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
-rw-r--r-- | bfd/ChangeLog | 6 | ||||
-rw-r--r-- | bfd/elfxx-x86.h | 1 | ||||
-rw-r--r-- | ld/ChangeLog | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr24458.s | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr24458a-x32.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr24458a.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr24458b-x32.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr24458b.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr24458c-x32.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pr24458c.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 6 |
11 files changed, 60 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 2289f2e201e..925dafab285 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2019-04-24 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/24458 + * elfxx-x86.h (SYMBOL_DEFINED_NON_SHARED_P): Also check x86 + linker_def. + 2019-03-18 Alan Modra <amodra@gmail.com> PR 24355 diff --git a/bfd/elfxx-x86.h b/bfd/elfxx-x86.h index 1f757fda0c1..d9af0980410 100644 --- a/bfd/elfxx-x86.h +++ b/bfd/elfxx-x86.h @@ -167,6 +167,7 @@ ((H)->def_regular \ || (H)->root.linker_def \ || (H)->root.ldscript_def \ + || ((struct elf_x86_link_hash_entry *) (H))->linker_def \ || ELF_COMMON_DEF_P (H)) /* TRUE if relative relocation should be generated. GOT reference to diff --git a/ld/ChangeLog b/ld/ChangeLog index 00c0785ede9..df78b1ce375 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,15 @@ +2019-04-24 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/24458 + * testsuite/ld-x86-64/x86-64.exp: Run PR ld/24458 tests. + * testsuite/ld-x86-64/pr24458.s: New file. + * testsuite/ld-x86-64/pr24458a-x32.d: Likewise. + * testsuite/ld-x86-64/pr24458a.d: Likewise. + * testsuite/ld-x86-64/pr24458b-x32.d: Likewise. + * testsuite/ld-x86-64/pr24458b.d: Likewise. + * testsuite/ld-x86-64/pr24458c-x32.d: Likewise. + * testsuite/ld-x86-64/pr24458c.d: Likewise. + 2019-02-10 H.J. Lu <hongjiu.lu@intel.com> PR ld/24151 diff --git a/ld/testsuite/ld-x86-64/pr24458.s b/ld/testsuite/ld-x86-64/pr24458.s new file mode 100644 index 00000000000..7dbd47af63f --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24458.s @@ -0,0 +1,5 @@ + .text + .globl _start + .type _start, @function +_start: + movq __ehdr_start(%rip), %rax diff --git a/ld/testsuite/ld-x86-64/pr24458a-x32.d b/ld/testsuite/ld-x86-64/pr24458a-x32.d new file mode 100644 index 00000000000..9b58786c02d --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24458a-x32.d @@ -0,0 +1,5 @@ +#source: pr24458.s +#as: --x32 +#ld: -m elf32_x86_64 +#readelf: -n +#pass diff --git a/ld/testsuite/ld-x86-64/pr24458a.d b/ld/testsuite/ld-x86-64/pr24458a.d new file mode 100644 index 00000000000..d14f66d23bf --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24458a.d @@ -0,0 +1,5 @@ +#source: pr24458.s +#as: --64 +#ld: -m elf_x86_64 +#readelf: -n +#pass diff --git a/ld/testsuite/ld-x86-64/pr24458b-x32.d b/ld/testsuite/ld-x86-64/pr24458b-x32.d new file mode 100644 index 00000000000..fa7950e7718 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24458b-x32.d @@ -0,0 +1,5 @@ +#source: pr24458.s +#as: --x32 +#ld: -pie -m elf32_x86_64 +#readelf: -n +#pass diff --git a/ld/testsuite/ld-x86-64/pr24458b.d b/ld/testsuite/ld-x86-64/pr24458b.d new file mode 100644 index 00000000000..8c0b534e0e0 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24458b.d @@ -0,0 +1,5 @@ +#source: pr24458.s +#as: --64 +#ld: -pie -m elf_x86_64 +#readelf: -n +#pass diff --git a/ld/testsuite/ld-x86-64/pr24458c-x32.d b/ld/testsuite/ld-x86-64/pr24458c-x32.d new file mode 100644 index 00000000000..344228fbbff --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24458c-x32.d @@ -0,0 +1,5 @@ +#source: pr24458.s +#as: --x32 +#ld: -shared -m elf32_x86_64 +#readelf: -n +#pass diff --git a/ld/testsuite/ld-x86-64/pr24458c.d b/ld/testsuite/ld-x86-64/pr24458c.d new file mode 100644 index 00000000000..1bc3de308e8 --- /dev/null +++ b/ld/testsuite/ld-x86-64/pr24458c.d @@ -0,0 +1,5 @@ +#source: pr24458.s +#as: --64 +#ld: -shared -m elf_x86_64 +#readelf: -n +#pass diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index ac41d8ea491..e6d9979d7cc 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -410,6 +410,12 @@ run_dump_test "pr23486b-x32" run_dump_test "pr23854" run_dump_test "pr24151a" run_dump_test "pr24151a-x32" +run_dump_test "pr24458a" +run_dump_test "pr24458a-x32" +run_dump_test "pr24458b" +run_dump_test "pr24458b-x32" +run_dump_test "pr24458c" +run_dump_test "pr24458c-x32" if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} { return |