https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77464
--- Comment #6 from Balint Reczey <balint at balintreczey dot hu> --- (In reply to Andrew Pinski from comment #5) > (In reply to Manuel López-Ibáñez from comment #3) > > Or at least give a clearer error that mentions -fPIC ... > > Actually this is not a driver issue just a binutils issue if that. Why add > no-pie anyways to the ldflags. I would like to enable --enable-default-pie in gcc but I would like to default to not using PIE in the top-level Makefile/configure of some projects. If "gcc -shared -no-pie foo.c" does not have the same result as "gcc -shared foo.c" this becomes practically impossible and one need to disable PIE for each binary one-by-one patching the build system. Also please note that reversing the parameters works and generates a shared library as expected: # gcc -no-pie -shared foo.c # file a.out a.out: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, BuildID[sha1]=6512dec4e91253fccda6977a39099c0d4d304629, not stripped One of those must be a valid bug. For practical reasons please consider the first reported issue as valid. From gcc's man page: -no-pie Don't produce a position independent executable. IMO -shared does not produce an executable, thus -no-pie should be silently handled as a noop without an error.