From 8cf0d2dd210b73dff4a2d63d60c49e42b86565a7 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 10 May 2012 03:25:17 +0000 Subject: Check 64-bit relocation addend overflow for x32 bfd/ * elf64-x86-64.c (elf_x86_64_relocate_section): Check addend overflow for R_X86_64_RELATIVE64. gas/ * config/tc-i386.c (tc_gen_reloc): Check x32 addend overflow for BFD_RELOC_64. gas/testsuite/ * gas/i386/ilp32/ilp32.exp: Run reloc64-inval. * gas/i386/ilp32/reloc64.s: Add tests for ".quad". * gas/i386/ilp32/reloc64.d: Updated. * gas/i386/ilp32/reloc64-inval.l: New file. * gas/i386/ilp32/reloc64-inval.s: Likewise. ld/testsuite/ * ld-x86-64/ilp32-11.d: New file. * ld-x86-64/ilp32-11.s: Likewise. * ld-x86-64/x86-64.exp: Run ilp32-11. --- gas/testsuite/ChangeLog | 10 ++++++++++ gas/testsuite/gas/i386/ilp32/ilp32.exp | 1 + gas/testsuite/gas/i386/ilp32/reloc64-inval.l | 3 +++ gas/testsuite/gas/i386/ilp32/reloc64-inval.s | 3 +++ gas/testsuite/gas/i386/ilp32/reloc64.d | 3 +++ gas/testsuite/gas/i386/ilp32/reloc64.s | 5 +++++ 6 files changed, 25 insertions(+) create mode 100644 gas/testsuite/gas/i386/ilp32/reloc64-inval.l create mode 100644 gas/testsuite/gas/i386/ilp32/reloc64-inval.s (limited to 'gas/testsuite') diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index e9c7bc7..7559561 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2012-05-09 H.J. Lu + + * gas/i386/ilp32/ilp32.exp: Run reloc64-inval. + + * gas/i386/ilp32/reloc64.s: Add tests for ".quad". + * gas/i386/ilp32/reloc64.d: Updated. + + * gas/i386/ilp32/reloc64-inval.l: New file. + * gas/i386/ilp32/reloc64-inval.s: Likewise. + 2012-05-08 Alan Modra * lib/gas-defs.exp (run_dump_test): Don't set LC_ALL here. diff --git a/gas/testsuite/gas/i386/ilp32/ilp32.exp b/gas/testsuite/gas/i386/ilp32/ilp32.exp index de43bf2..95f3a2d 100644 --- a/gas/testsuite/gas/i386/ilp32/ilp32.exp +++ b/gas/testsuite/gas/i386/ilp32/ilp32.exp @@ -26,6 +26,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check] && } run_list_test "reloc64" "--defsym _bad_=1" + run_list_test "reloc64-inval" set ASFLAGS "$old_ASFLAGS" } diff --git a/gas/testsuite/gas/i386/ilp32/reloc64-inval.l b/gas/testsuite/gas/i386/ilp32/reloc64-inval.l new file mode 100644 index 0000000..1328237 --- /dev/null +++ b/gas/testsuite/gas/i386/ilp32/reloc64-inval.l @@ -0,0 +1,3 @@ +.*: Assembler messages: +.*:2: Error: .* +.*:3: Error: .* diff --git a/gas/testsuite/gas/i386/ilp32/reloc64-inval.s b/gas/testsuite/gas/i386/ilp32/reloc64-inval.s new file mode 100644 index 0000000..14134aa --- /dev/null +++ b/gas/testsuite/gas/i386/ilp32/reloc64-inval.s @@ -0,0 +1,3 @@ + .data + .quad xtrn + 0x80000000 + .quad xtrn - 0x80000001 diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.d b/gas/testsuite/gas/i386/ilp32/reloc64.d index 08c15e4..140f24d 100644 --- a/gas/testsuite/gas/i386/ilp32/reloc64.d +++ b/gas/testsuite/gas/i386/ilp32/reloc64.d @@ -90,3 +90,6 @@ Disassembly of section \.data: .*[ ]+R_X86_64_PC16[ ]+xtrn .*[ ]+R_X86_64_8[ ]+xtrn .*[ ]+R_X86_64_PC8[ ]+xtrn +.*[ ]+R_X86_64_64[ ]+xtrn +.*[ ]+R_X86_64_64[ ]+xtrn\+0x7fffffff +.*[ ]+R_X86_64_64[ ]+xtrn\+0x80000000 diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.s b/gas/testsuite/gas/i386/ilp32/reloc64.s index 3f18d04..3a2dbb8 100644 --- a/gas/testsuite/gas/i386/ilp32/reloc64.s +++ b/gas/testsuite/gas/i386/ilp32/reloc64.s @@ -178,3 +178,8 @@ bad .byte xtrn@tpoff .text mov xtrn@tpoff (%rbx), %eax + + .data + .quad xtrn + .quad xtrn + 0x7fffffff + .quad xtrn - 0x80000000 -- cgit v1.1