-mpcrel and -fPIC and -m68000

Alexander Aganichev AAganichev@hypercom.com
Fri Jun 23 08:51:00 GMT 2000

I've made small patch that provides support for PC relative addressing on
m68000 with -fPIC option set. If someone intrested in testing here it is:
(See attached file: m68k.pcrel-68000.diff)

How it works:

On M68020 we already have the following code for calling:

     lea (label:l,%pc),%aX
     jsr (%aX)

It could be simulated on M68000 with:

     move #label-tmp_label,%aX
     lea tmp_label(%aX,%pc),%aX
     jsr (%aX)

Unfortunately I was unable to understand how to allocate temporary register
(I've tried to use `clobber' but failed) to make same trick with `pea', so
gcc generates `lea' followed by `move' in this version. I believe someone
who undertand gcc internals better make a better support for this feature.

Alexander Aganichev
Hypercom Europe Limited, Inc.
Software Engineer

-------------- next part --------------
A non-text attachment was scrubbed...
Name: m68k.pcrel-68000.diff
Type: text/x-diff
Size: 1383 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20000623/b74c115a/attachment.bin>

More information about the Gcc-patches mailing list