https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70419
Balint Reczey <balint at balintreczey dot hu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |balint at balintreczey dot hu --- Comment #1 from Balint Reczey <balint at balintreczey dot hu> --- Also please fix the error message emitted when trying to link a non-PIE non-PIC static library to a position independent executable: $ cat m.c #include <zlib.h> int main() { gzopen(0,0); return 1; } $gcc -pie m.c -lz /usr/bin/ld: /tmp/cchMINoQ.o: relocation R_X86_64_PC32 against undefined symbol `gzopen' can not be used when making a shared object; recompile with -fPIC /usr/bin/ld: final link failed: Bad value collect2: error: ld returned 1 exit status $ gcc --version gcc (Debian 6-20160228-1) 6.0.0 20160228 (experimental) [trunk revision 233789] One better error message could be: `gzopen' can not be used when making a position independent executable; recompile with -fPIC or -fPIE I can open a separate bug for that but this is closely related to the clarifications asked here.