From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28462 invoked by alias); 25 Feb 2011 19:21:54 -0000 Received: (qmail 28341 invoked by uid 22791); 25 Feb 2011 19:21:51 -0000 X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,NO_DNS_FOR_FROM,TW_CX,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga03.intel.com (HELO mga03.intel.com) (143.182.124.21) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 25 Feb 2011 19:21:46 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 25 Feb 2011 11:21:44 -0800 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by azsmga001.ch.intel.com with ESMTP; 25 Feb 2011 11:21:44 -0800 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 4E988180949; Fri, 25 Feb 2011 11:21:44 -0800 (PST) Date: Fri, 25 Feb 2011 19:21:00 -0000 From: "H.J. Lu" To: binutils@sourceware.org Subject: PATCH: Don't sign-check 4-byte relocations for x32 Message-ID: <20110225192144.GA15607@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-02/txt/msg00317.txt.bz2 Hi, We shouldn't sign-check 4-byte relocations for x32. I checked in this patch. H.J. --- diff --git a/gas/ChangeLog b/gas/ChangeLog index b90e75f..1f50886 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-check 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 c4c34a1..5cc8219 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 4bb775d..cc8dd9a 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,5 +1,15 @@ 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 * gas/elf/bad-size.d: New. * gas/elf/bad-size.err: Likewise. diff --git a/gas/testsuite/gas/i386/ilp32/ilp32.exp b/gas/testsuite/gas/i386/ilp32/ilp32.exp index 37f9b79..36a1d9a 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 e9e1b4d..08c15e4 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_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F32[ ]+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 0000000..ff49194 --- /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 48ce914..3f18d04 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