powerpc-eabi subroutine calls

Gunter Magin magin@skil.camelot.de
Tue Oct 30 09:15:00 GMT 2001


to make gcc generate a "far" subroutine call, an attribute must be added
to the function declaration:

     void foo (int bar1, char bar2) __attribute__ ((longcall));

This has to be done for any function which might be called from a location
more than 8MB away.

The generated assembler code looks like this:

    lis 9,foo@ha
    la 0,foo@l(9)
    mtlr 0
    li 4,0                 # 2nd argument
    li 3,100               # 1st argument

BTW, this is clearly documented in "Using and Porting the GNU Compiler 
Collection", chap. 4.23 "Declaring Atttibutes of Functions".

Thanks to Franz Fischer, who pointed that out to me in a private mail.

Gunter Magin                                         magin[AT]skil.camelot.de

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