This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

-mpcrel and -fPIC and -m68000


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
tmp_label:
     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

m68k.pcrel-68000.diff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]