[patch] MIPS: Fix synthesized doubleword transfers (ping)

Richard Sandiford rsandifo@redhat.com
Fri Feb 25 00:04:00 GMT 2005
cgd@broadcom.com writes:
> At Thu, 24 Feb 2005 21:05:49 +0000 (UTC), "Richard Sandiford" wrote:
>> I suppose bad things could happen if you composed an aligned
>> address from an unaligned symbol and an unaligned offset,
>> but is that allowed?
>
> yes, at least as far as the ISA is concerned.

I don't follow.  The ISA has no concept of symbols vs. offsets.

What I meant by the quote above was: suppose we have:

        ld <reg>,sym + offset

on a 32-bit target and:

        sym = 0x....4
        offset = 0x....4

sym + offset is aligned, but the individual values aren't.  That might
or might not be interpreted as satisfying any hypothetical "32-bit lds
must be to aligned addresses" requirement.

It's an assembler interface thing really.  Does the assembler require
the macros to use aligned addresses?  If so, does it require any symbol
part to be aligned too?  (Obviously the individual "lw"s don't care
about doubleword alignment, but that wasn't the point.)

I thought the answer to both was "yes", and what with the ABI
requirements, it'll be by far the common case.  OTOH...

> Also, it's perfectly well defined -- if a little bit strange (and
> remarkably slow, since you take an exception 8-) -- to do these
> accesses to odd addresses.

...if we want to support unaligned accesses, fair enough.
I guess the user can always use explicit relocs if they
know the address is aligned.

Richard



More information about the Binutils mailing list