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]

Re: PATCH: PR gas/10704: as segfault in memory lookup intel syntax


On Wed, Sep 30, 2009 at 12:01:52PM -0700, H.J. Lu wrote:
> Hi,
> 
> LOCAL_SYMBOL_CHECK may change its argument to converted local symbol.
> snapshot_symbol isn't prepared to deal with it.  This patch fixes it.
> OK to install?
> 

Here is the updated version.


H.J.
---
gas/

2009-09-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/10704
	* symbols.c (snapshot_symbol): Properly handle converted local
	symbol.

gas/testsuite/

2009-09-30  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/10704
	* gas/i386/intelok.s: Add a new test.

	* gas/i386/intelok.d: Updated.

Index: gas/testsuite/gas/i386/intelok.d
===================================================================
--- gas/testsuite/gas/i386/intelok.d	(revision 6959)
+++ gas/testsuite/gas/i386/intelok.d	(working copy)
@@ -204,4 +204,6 @@ Disassembly of section .text:
 [ 	]*[0-9a-f]+:	ea 03 00 00 00 05 00[ 	]+l?jmp[ 	]+0x5[,:]0x3
 [ 	]*[0-9a-f]+:	ff 15 00 00 00 00[ 	]+call[ 	]+DWORD PTR (ds:)?(0x)?0
 [ 	]*[0-9a-f]+:	66 ff 25 00 00 00 00[ 	]+jmp[ 	]+WORD PTR (ds:)?(0x)?0
+[0-9a-f]++ <.text>:
+[ 	]*[a-f0-9]+:	ff 24 85 00 00 00 00[ 	]+jmp[ 	]+DWORD PTR \[eax\*4\+0x0\]
 #pass
Index: gas/testsuite/gas/i386/intelok.s
===================================================================
--- gas/testsuite/gas/i386/intelok.s	(revision 6959)
+++ gas/testsuite/gas/i386/intelok.s	(working copy)
@@ -216,5 +216,5 @@ start:
 	call	dword ptr xtrn
 	jmp	word ptr xtrn
 
-	# Force a good alignment.
-	.p2align	4,0
+.L11:
+        jmp     DWORD PTR[ .L11  + %eax * 4 ]
Index: gas/symbols.c
===================================================================
--- gas/symbols.c	(revision 6959)
+++ gas/symbols.c	(working copy)
@@ -1482,6 +1482,15 @@ snapshot_symbol (symbolS **symbolPP, val
       *segP = locsym->lsy_section;
       *fragPP = local_symbol_get_frag (locsym);
     }
+  else if (symbolP != *symbolPP)
+    {
+      /* LOCAL_SYMBOL_CHECK may change symbolP to converted local
+	 symbol.  */
+      *symbolPP = symbolP;
+      *valueP = symbolP->sy_value.X_add_number;
+      *segP = symbolP->bsym->section;
+      *fragPP = symbolP->sy_frag;
+    }
   else
     {
       expressionS expr = symbolP->sy_value;


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