diff options
-rw-r--r-- | bfd/ChangeLog | 7 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 2 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 2 | ||||
-rw-r--r-- | ld/ChangeLog | 7 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/i386.exp | 1 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pcrel16-2.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/pcrel16-2.s | 12 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/pcrel16-2.d | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/x86-64.exp | 1 |
9 files changed, 40 insertions, 2 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 701357c..45397ef 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2021-04-26 Jan Beulich <jbeulich@suse.com> + + * elf32-i386.c (elf_howto_table): Switch R_386_PC16 to + complain_overflow_signed. + * elf64-x86-64.c (x86_64_elf_howto_table): Switch R_X86_64_PC16 + to complain_overflow_signed. + 2021-04-23 Eric Botcazou <ebotcazou@adacore.com> * elf.c (special_sections_p): Add .persistent.bss. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index dee5352..ffe7644 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -93,7 +93,7 @@ static reloc_howto_type elf_howto_table[]= HOWTO(R_386_16, 0, 1, 16, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_386_16", true, 0xffff, 0xffff, false), - HOWTO(R_386_PC16, 0, 1, 16, true, 0, complain_overflow_bitfield, + HOWTO(R_386_PC16, 0, 1, 16, true, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_386_PC16", true, 0xffff, 0xffff, true), HOWTO(R_386_8, 0, 0, 8, false, 0, complain_overflow_bitfield, diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index 1204b29..840555c 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -82,7 +82,7 @@ static reloc_howto_type x86_64_elf_howto_table[] = false), HOWTO(R_X86_64_16, 0, 1, 16, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_16", false, 0xffff, 0xffff, false), - HOWTO(R_X86_64_PC16,0, 1, 16, true, 0, complain_overflow_bitfield, + HOWTO(R_X86_64_PC16, 0, 1, 16, true, 0, complain_overflow_signed, bfd_elf_generic_reloc, "R_X86_64_PC16", false, 0xffff, 0xffff, true), HOWTO(R_X86_64_8, 0, 0, 8, false, 0, complain_overflow_bitfield, bfd_elf_generic_reloc, "R_X86_64_8", false, 0xff, 0xff, false), diff --git a/ld/ChangeLog b/ld/ChangeLog index b736aa8..9bb178e 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2021-04-26 Jan Beulich <jbeulich@suse.com> + + * testsuite/ld-i386/pcrel16-2.s, testsuite/ld-i386/pcrel16-2.d, + testsuite/ld-x86-64/pcrel16-2.d: New. + * testsuite/ld-i386/i386.exp: Run new test. + * testsuite/ld-x86-64/x86-64.exp: Likewise. + 2021-04-23 H.J. Lu <hongjiu.lu@intel.com> PR ld/27771 diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 6ad69a8..d0b3f69 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -297,6 +297,7 @@ run_dump_test "abs" run_dump_test "pcrel8" run_dump_test "pcrel16" run_dump_test "pcrel16abs" +run_dump_test "pcrel16-2" run_dump_test "alloc" run_dump_test "warn1" run_dump_test "tlsgd2" diff --git a/ld/testsuite/ld-i386/pcrel16-2.d b/ld/testsuite/ld-i386/pcrel16-2.d new file mode 100644 index 0000000..c1c340f --- /dev/null +++ b/ld/testsuite/ld-i386/pcrel16-2.d @@ -0,0 +1,5 @@ +#name: PCREL16 overflow (2) +#as: --32 +#ld: -melf_i386 +#error: .*relocation truncated to fit: R_386_PC16 .*t16.* +#error: .*relocation truncated to fit: R_386_PC16 .*_start.* diff --git a/ld/testsuite/ld-i386/pcrel16-2.s b/ld/testsuite/ld-i386/pcrel16-2.s new file mode 100644 index 0000000..2e97417 --- /dev/null +++ b/ld/testsuite/ld-i386/pcrel16-2.s @@ -0,0 +1,12 @@ + .text + .global _start +_start: + data16 xbegin t16 + ret + + .fill 0x8000,1,0xcc + + .global t16 +t16: + data16 xbegin _start + ret diff --git a/ld/testsuite/ld-x86-64/pcrel16-2.d b/ld/testsuite/ld-x86-64/pcrel16-2.d new file mode 100644 index 0000000..5346a5b --- /dev/null +++ b/ld/testsuite/ld-x86-64/pcrel16-2.d @@ -0,0 +1,5 @@ +#name: PCREL16 overflow (2) +#source: ../ld-i386/pcrel16-2.s +#ld: +#error: .*relocation truncated to fit: R_X86_64_PC16 .*t16.* +#error: .*relocation truncated to fit: R_X86_64_PC16 .*_start.* diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 877d6ba..269f70d 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -261,6 +261,7 @@ run_dump_test "abs-l1om" run_dump_test "apic" run_dump_test "pcrel8" run_dump_test "pcrel16" +run_dump_test "pcrel16-2" run_dump_test "tlsgd2" run_dump_test "tlsgd3" run_dump_test "tlsgd12" |