This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: long-calls in ARM
- To: Nick Clifton <nickc at cambridge dot redhat dot com>
- Subject: Re: long-calls in ARM
- From: Michael Meissner <meissner at cygnus dot com>
- Date: Mon, 10 Sep 2001 13:07:29 -0400
- Cc: Rafael Rodríguez Velilla <rrv at tid dot es>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- References: <3B9CE4CE.FFA6497@tid.es> <m3lmjnj8l5.fsf@north-pole.nickc.cambridge.redhat.com>
On Mon, Sep 10, 2001 at 05:48:06PM +0100, Nick Clifton wrote:
> Hi Rafael,
>
> > Would it be very difficult to allow gcc decide when does it have to
> > do long-calls and when not?
>
> It is impossible for gcc to automatically decide when it has to make
> long calls, since it cannot know where the functions and their callers
> are going to end up. (This decision is only made at link time),
In some targets, the linker will add a stub near the site of the call, which
then does a long jump to the function. This depends on the ABI specifying one
or more temp registers that the stub can use.
> The command line switch -mlong-calls however does exist and will tell
> gcc to make every function call a long call. This is the safe thing
> to do and probably the easiest solytion to your problem.
>
> There is also an arm specific function attribute called "long_call"
> which you can use to specifically label function which need to be
> treated as long calls. This does mean however that you will have to
> go through and individually annotate all of the long call functions'
> prototypes.
Another approach is to use a function pointer initialized to the address of the
function to call the function. You probably want to use a static pointer, to
prevent the optimizer from recombining things.
> (Alternatively you could use -mlong-calls and then annotate functions
> which only need the short call sequence by using the function
> attribute "short_call").
>
> Cheers
> Nick
>
--
Michael Meissner, Red Hat, Inc. (GCC group)
PMB 198, 174 Littleton Road #3, Westford, Massachusetts 01886, USA
Work: meissner@redhat.com phone: +1 978-486-9304
Non-work: meissner@spectacle-pond.org fax: +1 978-692-4482