[PATCH][GAS/ARM] Better handling of difference between a symbol and an undefined symbol.

H.J. Lu hjl.tools@gmail.com
Wed Mar 16 21:31:00 GMT 2011
On Tue, Sep 28, 2010 at 11:49 PM, Alan Modra <amodra@gmail.com> wrote:
> Fails on alpha-dec-vms, arm-coff, arm-pe, rs6000-aix*, xscale-coff.
> The dec-vma fail is due to objdump disliking -j .text, the others are,
> I think, real failures.
>
> gas/
>        * expr.c (expr): Correct returned segment value.
> gas/testsuite/
>        * gas/all/fwdexp.d, * gas/all/fwdexp.s: New test.
>        * gas/all/gas.exp: Run it.
>
> Index: gas/expr.c
> ===================================================================
> RCS file: /cvs/src/src/gas/expr.c,v
> retrieving revision 1.84
> diff -u -p -r1.84 expr.c
> --- gas/expr.c  2 Aug 2010 13:19:44 -0000       1.84
> +++ gas/expr.c  28 Sep 2010 23:11:49 -0000
> @@ -1969,16 +1969,27 @@ expr (int rankarg,              /* Larger # is highe
>
>       if (retval != rightseg)
>        {
> -         if (! SEG_NORMAL (retval))
> -           {
> -             if (retval != undefined_section || SEG_NORMAL (rightseg))
> -               retval = rightseg;
> -           }
> -         else if (SEG_NORMAL (rightseg)
> +         if (retval == undefined_section)
> +           ;
> +         else if (rightseg == undefined_section)
> +           retval = rightseg;
> +         else if (retval == expr_section)
> +           ;
> +         else if (rightseg == expr_section)
> +           retval = rightseg;
> +         else if (retval == reg_section)
> +           ;
> +         else if (rightseg == reg_section)
> +           retval = rightseg;
> +         else if (rightseg == absolute_section)
> +           ;
> +         else if (retval == absolute_section)
> +           retval = rightseg;
>  #ifdef DIFF_EXPR_OK
> -                  && op_left != O_subtract
> +         else if (op_left == O_subtract)
> +           ;
>  #endif
> -                  )
> +         else
>            as_bad (_("operation combines symbols in different segments"));
>        }
>

This caused:

http://www.sourceware.org/bugzilla/show_bug.cgi?id=12589

-- 
H.J.



More information about the Binutils mailing list