This is the mail archive of the
mailing list for the GCC project.
Re: Patch to correct LINK_PIE_SPEC
- From: "Peter S. Mazinger" <ps dot m at gmx dot net>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Mon, 15 Nov 2004 13:52:10 +0100 (CET)
- Subject: Re: Patch to correct LINK_PIE_SPEC
On Mon, 15 Nov 2004, Jakub Jelinek wrote:
> On Mon, Nov 15, 2004 at 01:30:36PM +0100, Peter S. Mazinger wrote:
> > > This is incorrect.
> > > When you specify -nostdlib or -nostartfiles, you certainly want -pie
> > > being passed down to ld if given to gcc. These options tell the compiler
> > No I certainly don't want to, and if I want to, then I'll provide a way
> > for it.
> > > that you are taking care of using the appropriate start files and/or libraries.
> > > Not passing -pie here would be very surprising and likely breaks
> > > e.g. glibc which heavily uses -nostdlib and -nostartfiles and uses -pie
> > > too.
> > that is really glibc's problem ;)
> No, it is a bug introduced by your patch.
well, if only glibc is involved, I don't understand why it should be my
> > As solution for glibc (I use it on uclibc) it can always overwrite the
> > above by either:
> > $(LD) -pie
> > or
> > $(GCC) -Wl,-pie (I think it uses it like this, could be though wrong)
> > glibc used pie last time I checked on nscd only (could have changed
> > though).
> Why should it? GCC -pie option means:
> 1) pass -pie to the linker if it supports it
> 2) user appropriate startfiles and/or libraries for PIE generation
yes, that's it, use appropiate startfiles (and this appropiate startfile
should provide also path for Scrt1.o because the normal startfile
definition won't be used)
> With gcc -pie -nostartfiles -nostdlibs only 1) applies, but gcc should
> still do that. Of course gcc -Wl,-pie -nostartfiles -nostdlibs will work too,
> assuming ld supports -pie, but nobody should be forced to use that.
The solution proposed was for glibc...
and it is ifdefd by HAVE_LD_PIE, so we know exactly that ld supports -pie.
also glibc's configure checks for ld -pie presence and enables
The other case if HAVE_LD_PIE is not defined (ld does not support -pie) is
Peter S. Mazinger <ps dot m at gmx dot net> ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08 BB6E C389 975E A5F0 59F2