This is the mail archive of the gcc-help@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]
Other format: [Raw text]

Re: statically linked PIEs without GOT


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


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