How should gcc handle "-shared -pie" and "-pie -shared"?

H.J. Lu
Tue Jul 3 19:06:00 GMT 2007

On Tue, Jul 03, 2007 at 08:50:29PM +0200, Andreas Schwab wrote:
> "H.J. Lu" <> writes:
> > Where is it documented.
> Nowhere.
> > Gcc 4.3 just passes "-shared -pie" to linker. I don't see gcc driver
> > remove -pie.
> Look at the use of Scrt1.o.  It's much of a mess.

Gcc currently ignores -pie when there is a -shared due to treatment
of Scrt1.o.  However, this behavior is undocumted.  We like to
match the linker behavior with gcc.

Is this gcc behavior intentional? Will this gcc behavior ever
change? Can we document this gcc behavior?

BTW, this is another problem which can be handled like:


More information about the Gcc mailing list