This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Add a warning for some problematic MIPS constants


On Wed, Sep 19, 2007 at 11:10:30AM -0700, Jim Wilson wrote:
> I've seen a similar problem with load/store instructions.  If you are
> trying to read memory mapped hardware registers in high memory, you
> might have an instruction like
> 	lw $4, 0x80000000
> Compile this with a mips-elf toolchain, run it on 64-bit hardware, and
> it loads from the address 0xffffffff80000000.  Compile this with a
> current mips64-elf toolchain, run it on 64-bit hardware, and it loads
> from the address 0x0000000080000000.  Compile it with an old mips64-elf
> toolchain, and it loads from 0xffffffff80000000.  This tripped up one of
> our customers.  The handling of constant addresses here is independent
> of whether this is a byte, half-word, word, or double-word load.
> 
> I agree that the current gas behaviour makes sense.  But if we are going
> to warn about the bne/sltu cases, then I think we should warn about the
> lw/sw/etc cases too.  I tried your patch, and it doesn't handle the
> load/store instruction cases.
> 
> I don't have access to the Diab assembler, but it presumably has the
> same issue here.

As far as I could tell, it does not.  But I may not have been able to
invoke it correctly; I don't have good documentation for its options.
I'd be happy if the warning covered the load and store cases too,
although I found that to be the most confusing part of the constant
loading code.

I'll look into it.

-- 
Daniel Jacobowitz
CodeSourcery


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]