https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77464
Bug ID: 77464 Summary: gcc -no-pie breaks -shared Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: balint at balintreczey dot hu Target Milestone: --- Compiling shared libraries is broken with -no-pie, which should be a noop in this case. Test: # echo "int bar(void) {return 0;}" > foo.c # gcc -shared foo.c # gcc -shared -no-pie foo.c /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/crt1.o: In function `_start': (.text+0x20): undefined reference to `main' collect2: error: ld returned 1 exit status This prevents enabling --enable-default-pie in Debian because when PIE is disabled for a package -no-pie is added to LDFLAGS. One failure due to this bug: https://people.debian.org/~lucas/logs/2016/08/30/pie-bindnow-20160830/with-pie-bindnow/afterstep_2.2.12-8_unstable_pie-bindnow.log.gz Some background on enabling PIE by default on Debian: https://lists.debian.org/debian-devel/2016/08/msg00620.html