https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78353
Bug ID: 78353 Summary: -flto omits some -Wl flags Product: gcc Version: 6.2.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: nico at linaro dot org Target Milestone: --- Host: ARM Target: ARM Build: ARM Given the following test code: int main(int x) { asm("teq %0, #0; addne %0, %0, #1" : "=r" (x)); return x; } $ gcc -march=armv7-a -mthumb -O2 -o test test.c /tmp/cc1cDOSv.s: Assembler messages: /tmp/cc1cDOSv.s:28: Error: thumb conditional instruction should be in IT block -- `addne r0,r0,#1' That was expected to fail. Now adding -Wa,-mimplicit-it=always to it: $ gcc -march=armv7-a -mthumb -O2 -Wa,-mimplicit-it=always -o test test.c Compilation completes. That was expected to work. Finally, adding -flto to that: $ gcc -march=armv7-a -mthumb -O2 -flto -Wa,-mimplicit-it=always -o test test.c /tmp/ccjAV98m.s: Assembler messages: /tmp/ccjAV98m.s:27: Error: thumb conditional instruction should be in IT block -- `addne r0,r0,#1' lto-wrapper: fatal error: gcc returned 1 exit status compilation terminated. /opt/gcc-6.2.1/bin/../lib/gcc/arm-linux-gnueabihf/6.2.1/../../../../arm-linux-gnueabihf/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status Certainly that wasn't supposed to fail.