[PATCH] D18183: [ELF] - -pie/--pic-executable option implemented

Joerg Sonnenberger via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 17 23:50:46 PDT 2016


On Thu, Mar 17, 2016 at 04:12:43PM -0700, Rafael EspĂ­ndola via llvm-commits wrote:
> On 15 March 2016 at 11:23, Rui Ueyama <ruiu at google.com> wrote:
> > ruiu added inline comments.
> >
> > ================
> > Comment at: ELF/Driver.cpp:150-151
> > @@ +149,4 @@
> > +      error("-shared and -pie may not be used together");
> > +    if (Config->Static)
> > +      error("-static and -pie may not be used together");
> > +  }
> > ----------------
> > Why is -pie incompatible with -static?
> 
> It is not fundamentally so. A static program can be self relocating
> and openbsd has static pie binaries.

Yes and no. "Static PIE binary" is a bit of a misnomer. It is
essentially the same as rtld itself -- you use the binary as its own
interpreter and all library references are resolved at link time to
(PIC) library archives.

Joerg


More information about the llvm-commits mailing list