This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: statically linked PIEs without GOT
- From: Ian Lance Taylor <iant at google dot com>
- To: Morten Shearman Kirkegaard <moki at fabletech dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 11 Jul 2012 07:36:57 -0700
- Subject: Re: statically linked PIEs without GOT
- References: <1342015572.7031.15.camel@pacific>
On Wed, Jul 11, 2012 at 7:06 AM, Morten Shearman Kirkegaard
<moki@fabletech.com> wrote:
>
> I have a somewhat strange request. I would like to generate statically
> linked position independent executables for I386 and AMD64. The source
> language is C, I use ELF for the object files, and link them using GNU
> ld with a custom linker script.
>
> The code generated by GCC with -fpic uses the Global Offset Table to
> resolve external symbols. Since my program will be statically linked, I
> would like to avoid this, to simplify loading. All symbols will be
> resolvable at link time.
>
> Is there an option to avoid using a GOT?
Such a thing could be supported in principle, by including a runtime
relocation routine in the executable itself. However, I'm not aware
of any current support for this.
Ian