[PATCH] x86: fix PR gas/11732

Jan Beulich JBeulich@novell.com
Mon Jun 21 15:23:00 GMT 2010


gas/
2010-06-21  Jan Beulich  <jbeulich@novell.com>

	PR gas/11732
	* config/tc-i386.c (i386_finalize_displacement): Don't call
	section_symbol() with expr_section.

gas/testsuite/
2010-06-21  Jan Beulich  <jbeulich@novell.com>

	PR gas/11732
	* gas/i386/i386.exp: Run new tests.
	* gas/i386/intel-got{32,64}.{s,d}: New.

--- 2010-06-09/gas/config/tc-i386.c	2010-06-09 17:04:12.000000000 +0200
+++ 2010-06-09/gas/config/tc-i386.c	2010-06-21 16:29:09.000000000 +0200
@@ -6849,7 +6849,8 @@ i386_finalize_displacement (segT exp_seg
 	goto inv_disp;
 
       if (S_IS_LOCAL (exp->X_add_symbol)
-	  && S_GET_SEGMENT (exp->X_add_symbol) != undefined_section)
+	  && S_GET_SEGMENT (exp->X_add_symbol) != undefined_section
+	  && S_GET_SEGMENT (exp->X_add_symbol) != expr_section)
 	section_symbol (S_GET_SEGMENT (exp->X_add_symbol));
       exp->X_op = O_subtract;
       exp->X_op_symbol = GOT_symbol;
--- 2010-06-09/gas/testsuite/gas/i386/i386.exp	2010-05-07 15:46:10.000000000 +0200
+++ 2010-06-09/gas/testsuite/gas/i386/i386.exp	2010-06-21 16:37:16.000000000 +0200
@@ -37,6 +37,7 @@ if [expr ([istarget "i*86-*-*"] ||  [ist
     run_dump_test "intel16"
     run_list_test "intelbad" ""
     run_dump_test "intelok"
+    run_dump_test "intel-got32"
     run_dump_test "prefix"
     run_dump_test "amd"
     run_dump_test "katmai"
@@ -315,6 +316,7 @@ if [expr ([istarget "i*86-*-*"] || [ista
       run_dump_test "x86-64-opcode-inval-intel"
     }
     run_dump_test "rexw"
+    run_dump_test "intel-got64"
     run_dump_test "x86-64-fxsave"
     run_dump_test "x86-64-fxsave-intel"
     run_dump_test "x86-64-arch-1"
--- 2010-06-09/gas/testsuite/gas/i386/intel-got32.d	1970-01-01 01:00:00.000000000 +0100
+++ 2010-06-09/gas/testsuite/gas/i386/intel-got32.d	2010-06-21 17:03:22.000000000 +0200
@@ -0,0 +1,11 @@
+#objdump: -dwMintel
+#name: i386 intel-got
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <_start>:
+[ 	]*[0-9a-f]+:[ 	]+8b 15 04 00 00 00[ 	]+mov[ 	]+edx,(DWORD PTR )?(ds:)?0x4
+[ 	]*[0-9a-f]+:[ 	]+c3[ 	]+ret[ 	]*
+#pass
--- 2010-06-09/gas/testsuite/gas/i386/intel-got32.s	1970-01-01 01:00:00.000000000 +0100
+++ 2010-06-09/gas/testsuite/gas/i386/intel-got32.s	2010-06-21 16:55:54.000000000 +0200
@@ -0,0 +1,7 @@
+.text
+.intel_syntax noprefix
+_start:
+	mov	edx, [x1@GOTOFF + x2]
+	ret
+
+.equ x2, 4
--- 2010-06-09/gas/testsuite/gas/i386/intel-got64.d	1970-01-01 01:00:00.000000000 +0100
+++ 2010-06-09/gas/testsuite/gas/i386/intel-got64.d	2010-06-21 17:17:07.000000000 +0200
@@ -0,0 +1,12 @@
+#objdump: -dwMintel
+#name: x86-64 intel-got
+
+.*: +file format .*
+
+Disassembly of section .text:
+
+0+000 <_start>:
+[ 	]*[0-9a-f]+:[ 	]+a1 00 00 00 00 00 00 00 00[ 	]+movabs[ 	]+eax,(ds:)?0x0
+[ 	]*[0-9a-f]+:[ 	]+ff 35 00 00 00 00[ 	]+push[ 	]+(QWORD PTR )?\[rip(\+(0x)?0)?\]([ 	]+#.*)?
+[ 	]*[0-9a-f]+:[ 	]+c3[ 	]+ret[ 	]*
+#pass
--- 2010-06-09/gas/testsuite/gas/i386/intel-got64.s	1970-01-01 01:00:00.000000000 +0100
+++ 2010-06-09/gas/testsuite/gas/i386/intel-got64.s	2010-06-21 16:56:04.000000000 +0200
@@ -0,0 +1,8 @@
+.text
+.intel_syntax noprefix
+_start:
+	movabs	eax, [x1@GOTOFF + x2]
+	push	[rip + x1@GOTPCREL + x2]
+	ret
+
+.equ x2, 8





More information about the Binutils mailing list