This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
Re: SH: PC-relative addressing
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: "Clarke, Stephen" <stephen dot clarke at superh dot com>
- Cc: <binutils at sources dot redhat dot com>
- Date: 01 Sep 2002 19:15:28 -0300
- Subject: Re: SH: PC-relative addressing
- Organization: GCC Team, Red Hat
- References: <287E4644B5249D449C56FA5409A874AE03EF9A@sh-us-ex01.us.w2k.superh.com>
On Aug 27, 2002, "Clarke, Stephen" <stephen.clarke@superh.com> wrote:
> I suspect that gas used to follow the Hitachi assembler
> behaviour, until it was changed as a result of the
> discussion beginning at:
> http://sources.redhat.com/ml/binutils/2002-01/msg00678.html
Actually, I don't think that patch ever changed the meaning of
@(number,pc), but rather only that of @(symbol-.,pc). It had never
been disputed before that @(number,pc) should be adjusted by -4 before
encoding in the opcode, to reflect the fact that 4 had already been
added to PC by the time of the computation of the address.
I know, however, that some months later (in June 2002), Jörn posted
another patch
<URL:http://sources.redhat.com/ml/binutils/2002-06/msg00175.html> that
introduced code to accept some additional code from another SuperH
customer, introducing support for @(symbol,pc) as a synonym for
@symbol with PC-relative addressing, i.e., with `symbol-.-4' added to
`pc+4'.
In case we stop subtracting 4 from the PC addend in case of an
absolute number, should we also stop doing so in case of
@(symbol-.,pc)? And how about in case of @(symbol,pc)?
As Jörn said, it is nice that @(num,pc) and @(symbol-.,pc) have the
same meaning, and that @(symbol-.,pc) actually refers to symbol's
memory address, instead of symbol+4. However, I see that people more
familiar with the hardware addressing modes might be confused by the
offset implicitly adjusted by gas, and that those using the explicit
@(number,pc) instead of relying on the assembler to turn @symbol into
an equivalent expression should probably be using @symbol anyway, so
I'd be willing to accept a patch that made GNU as behave like the
Hitachi assembler. However, it would be nice if such a patch
introduced a warning indicating a change in behavior. It's likely
that this strikes so rarely that nobody will notice and be bothered
:-)
H-P, Jörn, do you concur?
--
Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist Professional serial bug killer