This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: another problem with m68k-elf
- To: pjak at snafu dot de
- Subject: Re: another problem with m68k-elf
- From: amodra at one dot net dot au
- Date: Fri, 25 May 2001 09:35:57 +0930
- Cc: binutils at sources dot redhat dot com
- References: <E152rzl-0004Wp-00@smart.visp-europe.psi.com>
On Thu, May 24, 2001 at 12:05:29PM +0100, pjak@snafu.de wrote:
> x1:
> .space 16
> .set x2,.-x1
>
> .space x2
>[snip]
> "Error: .space specifies non-absolute value"
We can make this work fairly easily.
gas/ChangeLog
* expr.c (expr): Set return value to absolute_section for
subtractive operations on symbols within a segment.
* read.c (pseudo_set): Set segment for complex expressions.
--
Alan Modra
Index: gas/expr.c
===================================================================
RCS file: /cvs/src/src/gas/expr.c,v
retrieving revision 1.33
diff -u -p -r1.33 expr.c
--- expr.c 2001/05/22 10:23:48 1.33
+++ expr.c 2001/05/24 23:10:54
@@ -1862,6 +1862,19 @@ expr (rankarg, resultP)
resultP->X_add_number += right.X_add_number;
else if (op_left == O_subtract)
resultP->X_add_number -= right.X_add_number;
+ if (retval == rightseg
+ && (op_left == O_subtract
+ || op_left == O_eq
+ || op_left == O_ne
+ || op_left == O_lt
+ || op_left == O_le
+ || op_left == O_ge
+ || op_left == O_gt))
+ {
+ /* For subtractive operations on symbols within a
+ segment, the result will absolute. */
+ retval = absolute_section;
+ }
}
else
{
Index: gas/read.c
===================================================================
RCS file: /cvs/src/src/gas/read.c,v
retrieving revision 1.37
diff -u -p -r1.37 read.c
--- read.c 2001/05/14 22:37:47 1.37
+++ read.c 2001/05/24 23:11:10
@@ -3151,6 +3151,7 @@ pseudo_set (symbolP)
symbolS *symbolP;
{
expressionS exp;
+ segT seg;
#if (defined (OBJ_AOUT) || defined (OBJ_BOUT)) && ! defined (BFD_ASSEMBLER)
int ext;
#endif /* OBJ_AOUT or OBJ_BOUT */
@@ -3160,7 +3161,7 @@ pseudo_set (symbolP)
ext = S_IS_EXTERNAL (symbolP);
#endif /* OBJ_AOUT or OBJ_BOUT */
- (void) expression (&exp);
+ seg = expression (&exp);
if (exp.X_op == O_illegal)
as_bad (_("illegal expression; zero assumed"));
@@ -3236,9 +3237,9 @@ pseudo_set (symbolP)
break;
default:
- /* The value is some complex expression.
- FIXME: Should we set the segment to anything? */
+ /* The value is some complex expression. */
symbol_set_value_expression (symbolP, &exp);
+ S_SET_SEGMENT (symbolP, seg);
break;
}
}