Register-relative data addressing, especially m68k.

Gunther Nikl gni@gecko.de
Fri Feb 27 09:50:00 GMT 2004


On Thu, Feb 26, 2004 at 11:23:14AM -0500, Ian Lance Taylor wrote:
> 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.

  Its not in the FSF sources, but it does exists. The m68k-amigaos port
  works with 3.3, 3.4 and mainline (ableit there are bugs which might be
  port bugs or generic GCC bugs).

> If you can assume 68020 or higher, I think you can do what you want
> using GO_IF_LEGITIMATE_ADDRESS and LEGITIMIZE_ADDRESS.

  m68k-amigaos overrides LEGITIMATE_PIC_OPERAND_P.

> But I think you will need additional relocations in the assembler
> and linker, for ``offset from data base address''.

  Thats correct.

  Gunther



More information about the Gcc mailing list