diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2022-02-07 15:22:19 -0800 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2022-02-07 16:07:58 -0800 |
commit | 3cb97931a4728f652d1030edb9eada62d8ccc605 (patch) | |
tree | a85c02f6d816b0b703c139b966cc64e4122e27e9 /ld | |
parent | d9aa137fa307f7b13c033905876dca68326a35ab (diff) |
i386: Allow GOT32 relocations against ABS symbols
GOT32 relocations are allowed since absolute value + addend is stored in
the GOT slot.
Tested on glibc 2.35 build with GCC 11.2 and -Os.
bfd/
PR ld/28870
* elfxx-x86.c (_bfd_elf_x86_valid_reloc_p): Also allow GOT32
relocations.
ld/
PR ld/28870
* testsuite/ld-i386/i386.exp: Run pr28870.
* testsuite/ld-i386/pr28870.d: New file.
* testsuite/ld-i386/pr28870.s: Likewise.
(cherry picked from commit 30a954525f4e53a9cd50a1a8a6f201c7cf6595c7)
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr28870.d | 10 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pr28870.s | 6 |
3 files changed, 17 insertions, 0 deletions
diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index fe36b0fb53..82e14ab38d 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -509,6 +509,7 @@ run_dump_test "pr27491-3" run_dump_test "pr27491-4" run_dump_test "dt-relr-1a" run_dump_test "dt-relr-1b" +run_dump_test "pr28870" if { !([istarget "i?86-*-linux*"] || [istarget "i?86-*-gnu*"] diff --git a/ld/testsuite/ld-i386/pr28870.d b/ld/testsuite/ld-i386/pr28870.d new file mode 100644 index 0000000000..8e9b9fb82e --- /dev/null +++ b/ld/testsuite/ld-i386/pr28870.d @@ -0,0 +1,10 @@ +#as: --32 +#ld: --no-dynamic-linker -m elf_i386 -pie +#readelf: -s --wide + +#... +Symbol table '.symtab' contains [0-9]+ entries: + Num: Value Size Type Bind Vis Ndx Name +#... + +[a-f0-9]+: 00000002 0 NOTYPE LOCAL DEFAULT ABS foo +#pass diff --git a/ld/testsuite/ld-i386/pr28870.s b/ld/testsuite/ld-i386/pr28870.s new file mode 100644 index 0000000000..8e320470e2 --- /dev/null +++ b/ld/testsuite/ld-i386/pr28870.s @@ -0,0 +1,6 @@ + .text + .globl _start +_start: + addl foo@GOT(%ebx), %eax + cmpl $0, foo@GOT(%ebx) +foo = 2 |