m68k: 32 bit PC Relative code

Don Starr don@starrsoft.com
Tue Sep 3 01:34:00 GMT 2002


>Does anyone know of a way to generate PC relative code with
>32 bit offsets rather than 16 bit offsets for a m68k-coff
>target?  My processor (68328EZ) only supports the 68000
>instruction set, so I don't think it's possible with gcc
>2.95.3 (which is what I have setup now).  However, I thought
>someone might know how to do it on a later version, or at
>least someone would know if this sort of thing is supported
>yet.

My m68k-elf (2.95.3) target is building 32-bit displacement,
PC-relative code. Some caveats:
1. Some instructions, such as Bcc, do not support 32-bit
   displacements on the 68000 (need a 68020 or better).
2. I'm only seeing 32-bit displacements if the target address
   isn't known assembly time. (e.g. a target external to the
   current source module).

This:
 void externalFunc( void );
 void localFunc( void ) {}
 void func( void )
   {
   externalFunc();
   localFunc();
   }

generates this for the calls:
  19 000c 4EB9 0000 		jsr externalFunc
  19      0000 
  20 0012 4EBA FFEC 		jsr localFunc


So, it appears that you could get your 32-bit displacements if
you made all such calls "external".

-Don


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list