From f2d8a97c280123152204506e38c84e4e7dc7825b Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Fri, 25 Feb 2011 19:19:45 +0000 Subject: [PATCH] Don't sign-checking 4-byte relocations for x32. gas/ 2011-02-25 H.J. Lu * config/tc-i386.c (reloc): Don't sign-checking 4-byte relocations if 64bit relocations aren't allowed. gas/testsuite/ 2011-02-25 H.J. Lu * gas/i386/ilp32/ilp32.exp: Run reloc64. * gas/i386/ilp32/reloc64.s: Allow TLS relocations with 32bit register destinations. * gas/i386/ilp32/reloc64.d: Updated. * gas/i386/ilp32/reloc64.l: New. --- gas/ChangeLog | 5 +++ gas/config/tc-i386.c | 2 +- gas/testsuite/ChangeLog | 10 +++++ gas/testsuite/gas/i386/ilp32/ilp32.exp | 1 + gas/testsuite/gas/i386/ilp32/reloc64.d | 16 ++++++++ gas/testsuite/gas/i386/ilp32/reloc64.l | 53 ++++++++++++++++++++++++++ gas/testsuite/gas/i386/ilp32/reloc64.s | 32 ++++++++-------- 7 files changed, 102 insertions(+), 17 deletions(-) create mode 100644 gas/testsuite/gas/i386/ilp32/reloc64.l diff --git a/gas/ChangeLog b/gas/ChangeLog index b90e75f2cd8..1f50886e57c 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2011-02-25 H.J. Lu + + * config/tc-i386.c (reloc): Don't sign-checking 4-byte + relocations if 64bit relocations aren't allowed. + 2011-02-25 Alan Modra PR gas/12519 diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c index c4c34a1c3f1..5cc82190a8c 100644 --- a/gas/config/tc-i386.c +++ b/gas/config/tc-i386.c @@ -2591,7 +2591,7 @@ reloc (unsigned int size, } /* Sign-checking 4-byte relocations in 16-/32-bit code is pointless. */ - if (size == 4 && flag_code != CODE_64BIT) + if (size == 4 && (flag_code != CODE_64BIT || disallow_64bit_reloc)) sign = -1; rel = bfd_reloc_type_lookup (stdoutput, other); diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 4bb775d6aee..cc8dd9ae1a1 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,13 @@ +2011-02-25 H.J. Lu + + * gas/i386/ilp32/ilp32.exp: Run reloc64. + + * gas/i386/ilp32/reloc64.s: Allow TLS relocations with 32bit + register destinations. + * gas/i386/ilp32/reloc64.d: Updated. + + * gas/i386/ilp32/reloc64.l: New. + 2011-02-25 H.J. Lu PR gas/12519 diff --git a/gas/testsuite/gas/i386/ilp32/ilp32.exp b/gas/testsuite/gas/i386/ilp32/ilp32.exp index 37f9b797c1f..36a1d9a315b 100644 --- a/gas/testsuite/gas/i386/ilp32/ilp32.exp +++ b/gas/testsuite/gas/i386/ilp32/ilp32.exp @@ -22,6 +22,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check] && } run_list_test "inval" "-al" + run_list_test "reloc64" "--defsym _bad_=1" set ASFLAGS "$old_ASFLAGS" } diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.d b/gas/testsuite/gas/i386/ilp32/reloc64.d index e9e1b4d7137..08c15e41857 100644 --- a/gas/testsuite/gas/i386/ilp32/reloc64.d +++ b/gas/testsuite/gas/i386/ilp32/reloc64.d @@ -20,6 +20,10 @@ Disassembly of section \.text: .*[ ]+R_X86_64_PC8[ ]+xtrn\+0xf+f .*[ ]+R_X86_64_GOT32[ ]+xtrn .*[ ]+R_X86_64_GOT32[ ]+xtrn +.*[ ]+R_X86_64_GOT32[ ]+xtrn +.*[ ]+R_X86_64_GOT32[ ]+xtrn +.*[ ]+R_X86_64_GOTPCREL[ ]+xtrn +.*[ ]+R_X86_64_GOTPCREL[ ]+xtrn .*[ ]+R_X86_64_GOTPCREL[ ]+xtrn .*[ ]+R_X86_64_GOTPCREL[ ]+xtrn .*[ ]+R_X86_64_GOTPCREL[ ]+xtrn\+0xf+c @@ -29,18 +33,30 @@ Disassembly of section \.text: .*[ ]+R_X86_64_GOTPC32[ ]+_GLOBAL_OFFSET_TABLE_\+0x0*2 .*[ ]+R_X86_64_PLT32[ ]+xtrn .*[ ]+R_X86_64_PLT32[ ]+xtrn +.*[ ]+R_X86_64_PLT32[ ]+xtrn +.*[ ]+R_X86_64_PLT32[ ]+xtrn .*[ ]+R_X86_64_PLT32[ ]+xtrn\+0xf+c .*[ ]+R_X86_64_TLSGD[ ]+xtrn .*[ ]+R_X86_64_TLSGD[ ]+xtrn +.*[ ]+R_X86_64_TLSGD[ ]+xtrn +.*[ ]+R_X86_64_TLSGD[ ]+xtrn .*[ ]+R_X86_64_TLSGD[ ]+xtrn\+0xf+c .*[ ]+R_X86_64_GOTTPOFF[ ]+xtrn .*[ ]+R_X86_64_GOTTPOFF[ ]+xtrn +.*[ ]+R_X86_64_GOTTPOFF[ ]+xtrn +.*[ ]+R_X86_64_GOTTPOFF[ ]+xtrn .*[ ]+R_X86_64_GOTTPOFF[ ]+xtrn\+0xf+c .*[ ]+R_X86_64_TLSLD[ ]+xtrn .*[ ]+R_X86_64_TLSLD[ ]+xtrn +.*[ ]+R_X86_64_TLSLD[ ]+xtrn +.*[ ]+R_X86_64_TLSLD[ ]+xtrn .*[ ]+R_X86_64_TLSLD[ ]+xtrn\+0xf+c .*[ ]+R_X86_64_DTPOFF32[ ]+xtrn .*[ ]+R_X86_64_DTPOFF32[ ]+xtrn +.*[ ]+R_X86_64_DTPOFF32[ ]+xtrn +.*[ ]+R_X86_64_DTPOFF32[ ]+xtrn +.*[ ]+R_X86_64_TPOFF32[ ]+xtrn +.*[ ]+R_X86_64_TPOFF32[ ]+xtrn .*[ ]+R_X86_64_TPOFF32[ ]+xtrn .*[ ]+R_X86_64_TPOFF32[ ]+xtrn .*[ ]+R_X86_64_TPOFF32[ ]+xtrn diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.l b/gas/testsuite/gas/i386/ilp32/reloc64.l new file mode 100644 index 00000000000..ff491945971 --- /dev/null +++ b/gas/testsuite/gas/i386/ilp32/reloc64.l @@ -0,0 +1,53 @@ +.*: Assembler messages: +.*:33: Error: .* +.*:34: Error: .* +.*:37: Error: .* +.*:39: Error: .* +.*:40: Error: .* +.*:41: Error: .* +.*:42: Error: .* +.*:43: Error: .* +.*:44: Error: .* +.*:45: Error: .* +.*:47: Error: .* +.*:50: Error: .* +.*:51: Error: .* +.*:69: Error: .* +.*:72: Error: .* +.*:73: Error: .* +.*:77: Error: .* +.*:79: Error: .* +.*:82: Error: .* +.*:83: Error: .* +.*:88: Error: .* +.*:91: Error: .* +.*:92: Error: .* +.*:97: Error: .* +.*:100: Error: .* +.*:101: Error: .* +.*:108: Error: .* +.*:109: Error: .* +.*:112: Error: .* +.*:116: Error: .* +.*:117: Error: .* +.*:120: Error: .* +.*:126: Error: .* +.*:140: Error: .* +.*:153: Error: .* +.*:154: Error: .* +.*:155: Error: .* +.*:158: Error: .* +.*:159: Error: .* +.*:160: Error: .* +.*:161: Error: .* +.*:162: Error: .* +.*:163: Error: .* +.*:167: Error: .* +.*:168: Error: .* +.*:169: Error: .* +.*:172: Error: .* +.*:173: Error: .* +.*:174: Error: .* +.*:175: Error: .* +.*:176: Error: .* +.*:177: Error: .* diff --git a/gas/testsuite/gas/i386/ilp32/reloc64.s b/gas/testsuite/gas/i386/ilp32/reloc64.s index 48ce914bd45..3f18d04b025 100644 --- a/gas/testsuite/gas/i386/ilp32/reloc64.s +++ b/gas/testsuite/gas/i386/ilp32/reloc64.s @@ -29,11 +29,11 @@ ill mov $(xtrn - .), %eax jrcxz xtrn add $xtrn@got, %rax -bad mov $xtrn@got, %eax + mov $xtrn@got, %eax bad mov $xtrn@got, %ax bad mov $xtrn@got, %al mov xtrn@got(%rbx), %eax -bad mov xtrn@got(%ebx), %eax + mov xtrn@got(%ebx), %eax bad call xtrn@got bad add $xtrn@gotoff, %rax @@ -46,11 +46,11 @@ bad call xtrn@gotoff bad movabs $xtrn@gotpcrel, %rax add $xtrn@gotpcrel, %rax -bad mov $xtrn@gotpcrel, %eax + mov $xtrn@gotpcrel, %eax bad mov $xtrn@gotpcrel, %ax bad mov $xtrn@gotpcrel, %al mov xtrn@gotpcrel(%rbx), %eax -bad mov xtrn@gotpcrel(%ebx), %eax + mov xtrn@gotpcrel(%ebx), %eax call xtrn@gotpcrel ill movabs $_GLOBAL_OFFSET_TABLE_, %rax @@ -68,55 +68,55 @@ ill add $(_GLOBAL_OFFSET_TABLE_ - .), %al bad movabs $xtrn@plt, %rax add $xtrn@plt, %rax -bad mov $xtrn@plt, %eax + mov $xtrn@plt, %eax bad mov $xtrn@plt, %ax bad mov $xtrn@plt, %al mov xtrn@plt(%rbx), %eax -bad mov xtrn@plt(%ebx), %eax + mov xtrn@plt(%ebx), %eax call xtrn@plt bad jrcxz xtrn@plt bad movabs $xtrn@tlsgd, %rax add $xtrn@tlsgd, %rax -bad mov $xtrn@tlsgd, %eax + mov $xtrn@tlsgd, %eax bad mov $xtrn@tlsgd, %ax bad mov $xtrn@tlsgd, %al mov xtrn@tlsgd(%rbx), %eax -bad mov xtrn@tlsgd(%ebx), %eax + mov xtrn@tlsgd(%ebx), %eax call xtrn@tlsgd bad movabs $xtrn@gottpoff, %rax add $xtrn@gottpoff, %rax -bad mov $xtrn@gottpoff, %eax + mov $xtrn@gottpoff, %eax bad mov $xtrn@gottpoff, %ax bad mov $xtrn@gottpoff, %al mov xtrn@gottpoff(%rbx), %eax -bad mov xtrn@gottpoff(%ebx), %eax + mov xtrn@gottpoff(%ebx), %eax call xtrn@gottpoff bad movabs $xtrn@tlsld, %rax add $xtrn@tlsld, %rax -bad mov $xtrn@tlsld, %eax + mov $xtrn@tlsld, %eax bad mov $xtrn@tlsld, %ax bad mov $xtrn@tlsld, %al mov xtrn@tlsld(%rbx), %eax -bad mov xtrn@tlsld(%ebx), %eax + mov xtrn@tlsld(%ebx), %eax call xtrn@tlsld add $xtrn@dtpoff, %rax -bad mov $xtrn@dtpoff, %eax + mov $xtrn@dtpoff, %eax bad mov $xtrn@dtpoff, %ax bad mov $xtrn@dtpoff, %al mov xtrn@dtpoff(%rbx), %eax -bad mov xtrn@dtpoff(%ebx), %eax + mov xtrn@dtpoff(%ebx), %eax bad call xtrn@dtpoff add $xtrn@tpoff, %rax -bad mov $xtrn@tpoff, %eax + mov $xtrn@tpoff, %eax bad mov $xtrn@tpoff, %ax bad mov $xtrn@tpoff, %al mov xtrn@tpoff(%rbx), %eax -bad mov xtrn@tpoff(%ebx), %eax + mov xtrn@tpoff(%ebx), %eax bad call xtrn@tpoff .data -- 2.30.2