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.