https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78087
Bug ID: 78087 Summary: gcc 6.2.0 fails to link temacs from emacs-25.1 with -O0 -flto Product: gcc Version: 6.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: howarth.at.gcc at gmail dot com Target Milestone: --- The gcc 6.2.0 compiler fails to link temacs in a build of emacs 25.1 when the "-O0 -flto" flag is passed on CFLAGS and "-flto" on LDFLAGS. This issue occurs on x86_64-apple-darwin15 where the failure appears as... CCLD temacs /var/folders/vh/xthx1f251nqfj804049zl1wm0000gn/T//cc5Viitn.s:288358:1: error: assembler local symbol 'L1' not defined ... /var/folders/vh/xthx1f251nqfj804049zl1wm0000gn/T//cc5Viitn.s:288358:1: error: assembler local symbol 'L174' not defined and on x86_64 linux using a build gcc 6.2.0 with configure edited to set build_lto_plugin=no on ELF to use the same code LTO code generation path on linux as darwin... CCLD temacs /tmp/cc7ZBmmQ.ltrans0.ltrans.o:(.rodata+0x135a0): undefined reference to `.L1' ... /tmp/cc7ZBmmQ.ltrans0.ltrans.o:(.rodata+0x13bc8): more undefined references to `.L174' follow collect2: fatal error: ld returned 1 exit status On x86_64 linux, the issue is suppressed when the -O1 optimization level or higher is used. On x86_64 darwin, the linker failure in PR78077 occurs when the -O1 optimization level or higher is used.