https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86517
--- Comment #2 from Jan Hubicka <hubicka at ucw dot cz> --- > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86517 > > H.J. Lu <hjl.tools at gmail dot com> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > Status|UNCONFIRMED |RESOLVED > CC| |hjl.tools at gmail dot com > Resolution|--- |INVALID > > --- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> --- > I(In reply to Martin Liška from comment #0) > > > > > $ gcc -flto -c -fPIE -O2 1.i 2.i && gcc -fPIC -c -O2 lib.i -flto && ar rv > > x.a lib.o && gcc -pie -O2 -pthread -ldl -lxml2 1.o 2.o x.a -rdynamic -flto=9 > > -shared > > r - lib.o > > I don't believe you can build a shared object with -fPIE and linker tells > you to recompile with -fPIC. I think the problem here is that you can compile PIE and PIC object into pie binary at least on x86-64, but the way we merge options in lto-wrapper, we disable both PIE and PIC at LTO linktime. I think we ought to consider PIE as lower variant of PIC and resolve such funny combination as -fPIE. Honza