This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

PATCH: Don't sign-check 4-byte relocations for x32


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  <hongjiu.lu@intel.com>
+
+	* config/tc-i386.c (reloc): Don't sign-check 4-byte relocations
+	if 64bit relocations aren't allowed.
+
 2011-02-25  Alan Modra  <amodra@gmail.com>
 
 	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  <hongjiu.lu@intel.com>
 
+	* 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  <hongjiu.lu@intel.com>
+
 	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_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 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]