Register-relative data addressing, especially m68k.

Ian Lance Taylor ian@wasabisystems.com
Thu Feb 26 17:06:00 GMT 2004


Ray Whitmer <ray@xmission.com> writes:

> a5 points to the data section that contains the variables, and the offsets
> from a5 are to the actual data variables, not to an indirect reference to
> the variable.

I did this once, many many years ago, in gcc 1.37.1:
    http://groups.google.com/groups?q=Ian+Lance+Taylor+AMOS+gcc+1.37.1&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=9012162035.AA00827%40uunet.uu.net&rnum=2

Actually the first significant work I did on gcc.  I doubt that the
patch is particularly useful now, but it's mildly amusing that the
functionality still isn't in there.  More amusing for me than for you,
I suppose.

If you can assume 68020 or higher, I think you can do what you want
using GO_IF_LEGITIMATE_ADDRESS and LEGITIMIZE_ADDRESS.  But I think
you will need additional relocations in the assembler and linker, for
``offset from data base address''.

Ian



More information about the Gcc mailing list