[asm] Difference of symbols in another section

Harshad R Joglekar harshad.joglekar@wipro.com
Sat Sep 8 08:02:00 GMT 2001


"Alan Modra" wrote:
> 
> With the current assembler, you get a branch to start+2.  Seems OK to me.
> 

The assembler gives an error only when listings are enabled:
Error:operation combines symbols in different segments

After some debugging though, I can see why you reverted that patch. I am
looking for an alternate solution.

The problem is expr () converts the expression (foo - bar) to a
O_constant when they are in the same frag. When listings are enabled, a
dummy frag is created for each input line, so the expression will be in
the data section.

How about removing the check itself from expr.c (patch below)? This
check is probably being done later when resolving symbols ??

regards
-- 
Harshad

Index: expr.c
===================================================================
RCS file: src/binutils/gas/expr.c,v
retrieving revision 1.1.1.1
diff -u -B -p -r1.1.1.1 expr.c
--- expr.c      24 Jul 2001 15:59:46 -0000      1.1.1.1
+++ expr.c      8 Sep 2001 20:03:33 -0000
@@ -1701,13 +1701,6 @@ expr (rankarg, resultP)
        }
       else if (! SEG_NORMAL (retval))
        retval = rightseg;
-      else if (SEG_NORMAL (rightseg)
-              && retval != rightseg
-#ifdef DIFF_EXPR_OK
-              && op_left != O_subtract
-#endif
-              )
-       as_bad (_("operation combines symbols in different segments"));
 
       op_right = operator (&op_chars);


More information about the Binutils mailing list