On Wed, Jan 28, 2009 at 1:40 AM, Andi Kleen <a...@firstfloor.org> wrote: > On Wed, Jan 28, 2009 at 10:21:16AM +0100, Paolo Bonzini wrote: >> Andi Kleen wrote: >> > On Wed, Jan 28, 2009 at 09:39:39AM +0100, Paolo Bonzini wrote: >> >>> He'll get much better code by putting the program into a -fPIC .so, >> >>> loading it from a small stub and then unmap the stub. >> >>> large model generates really very bad code because all jumps >> >>> will be indirect. >> >> Is it also true with -fpie? >> > >> > Not sure what you mean? >> >> Right, sorry. I meant "can you also use -fpie and use a linker script >> to relocate the text section", if you want to place it high but the code >> is not gigantic? > > That would require -fpie crt* > > Probably doable, but needs some more effort than just > using a classical main() stub. >
It works fine with the latest binutils from CVS: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38988#c4 -- H.J.