This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
PATCH: PR gas/10704: as segfault in memory lookup intel syntax
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: binutils at sources dot redhat dot com
- Cc: jbeulich at novell dot com
- Date: Wed, 30 Sep 2009 12:01:52 -0700
- Subject: PATCH: PR gas/10704: as segfault in memory lookup intel syntax
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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?
Thanks.
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)
@@ -1485,6 +1485,9 @@ snapshot_symbol (symbolS **symbolPP, val
else
{
expressionS expr = symbolP->sy_value;
+ /* LOCAL_SYMBOL_CHECK may change symbolP to converted local
+ symbol. */
+ int local = symbolP != *symbolPP;
if (!symbolP->sy_resolved && expr.X_op != O_illegal)
{
@@ -1515,7 +1518,8 @@ snapshot_symbol (symbolS **symbolPP, val
}
/* Never change a defined symbol. */
- if (symbolP->bsym->section == undefined_section
+ if (local
+ || symbolP->bsym->section == undefined_section
|| symbolP->bsym->section == expr_section)
*symbolPP = symbolP;
*valueP = expr.X_add_number;