https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88185
Bug ID: 88185 Summary: LTO merges -fPIC/fpie and -fPIE/-fpie options to nothing - fails to warn when both are specified Product: gcc Version: 8.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: danglin at gcc dot gnu.org CC: marxin at gcc dot gnu.org Target Milestone: --- Host: hppa-unknown-linux-gnu Target: hppa-unknown-linux-gnu Build: hppa-unknown-linux-gnu The systemd package fails to build on hppa-linux with gcc-8. See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=909396 The build fails when it tries to link a pie executable. It's main object was compiled with -fPIE. Several archive libraries are linked against the main object. These contain objects compiled with both the -fPIE and -fPIC options. Only the -fPIC option is recorded for LTO. In gcc-8, -fPIE + -fPIC are merged to nothing. So, the link fails when non position-independent object is generated for an LTO object. There is no warning about using -fPIE and -fPIC together. The documentation implies these options are not compatible. In the systemd build, the addition of these options is done by meson and it's not clear why both are added.