This is the mail archive of the binutils@sources.redhat.com 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: [patch] MIPS: Fix synthesized doubleword transfers (ping)


cgd@broadcom.com writes:
> At Thu, 24 Feb 2005 22:20:30 +0000, Richard Sandiford wrote:
>> 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.
>
> right, but to some degree symbol + offset -> base reg + offset, since
> the offsets in the base regs come directly from the relocs.

Not really.  ld is the equivalent of:

        lui     tmp,%hi(foo)
        lw      w1,%lo(foo)(tmp)
        lw      w2,%lo(foo+4)(tmp)

where the base register (tmp) is the high part of "sym + offset"
(lowest 16 bits all 0).  We don't load the symbol part into a
temporary register and then add the offset.

For example, the linker will generate the same output for:

        foo = sym + offset, sym = 0x10004, offset = 4
        foo = sym + offset, sym = 0x10008, offset = 0

Richard


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