Add a warning for some problematic MIPS constants
Thiemo Seufer
ths@networkno.de
Wed Sep 19 16:06:00 GMT 2007
Daniel Jacobowitz wrote:
> MIPS maintainers, could I please get your opinion of this patch?
>
> A customer of ours (Wind River) has a second MIPS assembler (Diab).
> Their MIPS assembler makes some different choices than gas does about
> which constants should be sign extended. Richard explained the logic
> of gas's choices to me, and I entirely agree with it. However, it's a
> bit subtle and I wouldn't be surprised if some gas users expected
> the opposite behavior.
>
> The cases I'm trying to warn about are instructions that do not have a
> clear explicit width. For instance, "li" and "dli" are obvious, but
> bne and sltu are not. If you write "bne $4,0x80000000,label" gas
> zero extends the constant, and Diab sign extends it.
>
> While writing the test I turned on NewABI tests for mips-linux; they
> work fine nowadays.
>
> --
> Daniel Jacobowitz
> CodeSourcery
>
> 2007-09-19 Daniel Jacobowitz <dan@codesourcery.com>
>
> * config/tc-mips.c (mips_warn_unsigned): New.
> (unsigned_warning): New.
> (set_at, macro, macro2): Call it.
> (OPTION_WARN_UNSIGNED, OPTION_NO_WARN_UNSIGNED): Define.
> (md_longopts): Add --warn-unsigned and --no-warn-unsigned.
> (md_parse_option): Likewise.
> * doc/c-mips.texi (MIPS Opts): Document --warn-unsigned.
>
> 2007-09-19 Daniel Jacobowitz <dan@codesourcery.com>
>
> * gas/mips/mips.exp: Run NewABI tests for mips*-*-linux*. Add
> unsigned-warn-1.
> * unsigned-warn-1.d, unsigned-warn-1.l, unsigned-warn-1.s: New.
Ok.
Thiemo
More information about the Binutils
mailing list