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

H.J. Lu hjl.tools@gmail.com
Wed Oct 7 03:44:00 GMT 2009


On Tue, Oct 6, 2009 at 1:40 AM, Jan Beulich <JBeulich@novell.com> wrote:
>>>> Alan Modra <amodra@bigpond.net.au> 06.10.09 00:12 >>>
>>On Mon, Oct 05, 2009 at 01:59:08PM +0200, Tristan Gingold wrote:
>>> So, for the release you propose to revert PR2127 and to add .cfi_sections
>>> patch.
>>> I will do a new pre-release with that.
>>
>>I have applied the following to mainline, which fixes PR10704 and the
>>wrong use of expression_and_evaluate I found in s_reloc.  I don't
>>think this is acceptable for a release, unless you don't care about
>>ia64.  Jan, do you have any comments on
>>http://sourceware.org/ml/binutils/2009-10/msg00093.html ?
>
> I agree with your analysis, and based on that it's quite obvious that
> parse_operand() needs an extra parameter indicating whether the
> expression dealt with is to be resolved immediately. Basically, all
> uses outside of parse_operands() appear to need immediate
> resolution. But the uses inside parse_operands() are perhaps more
> difficult: Register and certain immediate operands (at least those
> which can't be encoded in a relocation) should be resolved
> immediately, while symbol references shouldn't.
>
> The immediates are what appears most problematic: In certain cases
> you can't easily tell whether the operand is symbolic or constant, and
> for non-forward-ref equates you want to resolve the latter, but
> not touch the former (based on your responses to the respective
> thread a couple of weeks back - though that's a backend independent
> problem I think, it just appears that ia64 is most obviously affected
> by it).
>

This patch fixes the testcase. Does it look OK?

Thanks.


-- 
H.J.
---
2009-10-06  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/2127
	* config/tc-ia64.c (parse_operand): Use expression instead
	of expression_and_evaluate.
	(parse_operands): Call resolve_expression on operands if
	needed.
-------------- next part --------------
2009-10-06  H.J. Lu  <hongjiu.lu@intel.com>

	PR gas/2127
	* config/tc-ia64.c (parse_operand): Use expression instead
	of expression_and_evaluate.
	(parse_operands): Call resolve_expression on operands if
	needed.

diff --git a/gas/config/tc-ia64.c b/gas/config/tc-ia64.c
index 3a9a74f..015a03a 100644
--- a/gas/config/tc-ia64.c
+++ b/gas/config/tc-ia64.c
@@ -5851,7 +5851,7 @@ parse_operand (expressionS *e, int more)
   memset (e, 0, sizeof (*e));
   e->X_op = O_absent;
   SKIP_WHITESPACE ();
-  expression_and_evaluate (e);
+  expression (e);
   sep = *input_line_pointer;
   if (more && (sep == ',' || sep == more))
     ++input_line_pointer;
@@ -5944,6 +5944,35 @@ parse_operands (struct ia64_opcode *idesc)
       return 0;
     }
 
+  for (i = 0; i < num_operands; i++)
+    switch (idesc->operands[i])
+      {
+      case IA64_OPND_IMM1:
+      case IA64_OPND_IMM8:
+      case IA64_OPND_IMM8U4:
+      case IA64_OPND_IMM8M1:
+      case IA64_OPND_IMM8M1U4:
+      case IA64_OPND_IMM8M1U8:
+      case IA64_OPND_IMM9a:
+      case IA64_OPND_IMM9b:
+      case IA64_OPND_IMM14:
+      case IA64_OPND_IMM22:
+      case IA64_OPND_IMMU62:
+      case IA64_OPND_IMMU64:
+      case IA64_OPND_TGT25:
+      case IA64_OPND_TGT25b:
+      case IA64_OPND_TGT25c:
+      case IA64_OPND_TGT64:
+      case IA64_OPND_TAG13:
+      case IA64_OPND_TAG13b:
+      case IA64_OPND_LDXMOV:
+	break;
+      default:
+	/* Resolve it since this operand doesn't take relocation. */
+	resolve_expression (CURR_SLOT.opnd + i);
+	break;
+      }
+
   if (idesc->operands[2] == IA64_OPND_SOF
       || idesc->operands[1] == IA64_OPND_SOF)
     {


More information about the Binutils mailing list