From 40e3ba9bb7d85d35590a8828a42b3450e0dcb032 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 25 May 2001 00:01:30 +0000 Subject: [PATCH] * 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. --- gas/ChangeLog | 4 ++++ gas/expr.c | 13 +++++++++++++ gas/read.c | 7 ++++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 6f5b600418c..6abbd8ec7d5 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,5 +1,9 @@ 2001-05-25 Alan Modra + * 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. + From 2.11 branch 2001-03-30 Richard Henderson * config/tc-i386.c (md_convert_frag): Don't die on local symbols that have been finalized. diff --git a/gas/expr.c b/gas/expr.c index f79e31cbe3a..7e6ad903373 100644 --- a/gas/expr.c +++ b/gas/expr.c @@ -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 { diff --git a/gas/read.c b/gas/read.c index 209ab6ad08a..c14d2c0028f 100644 --- a/gas/read.c +++ b/gas/read.c @@ -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; } } -- 2.30.2