https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101382
Bug ID: 101382 Summary: function declarations with identical asm label aliasing a target function does not compile with -flto Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto Assignee: unassigned at gcc dot gnu.org Reporter: fabian.parzefall at mailbox dot org CC: marxin at gcc dot gnu.org Target Milestone: --- Created attachment 51120 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51120&action=edit Input reproducing the bug GCC cannot compile a module containing two function declarations with the same asm label and the same alias attribute when -flto is enabled. Here is an excerpt from the attachment: void a(void) { ... } extern typeof(a) b asm("x") __attribute__((alias("a"))); extern typeof(a) c asm("x") __attribute__((alias("a"))); When compiling with: gcc -flto -c -o gcc-lto-asm-label-bug.o gcc-lto-asm-label-bug.c gcc -flto -o gcc-lto-asm-label-bug gcc-lto-asm-label-bug.o The second command invoked produces this error message: lto1: fatal error: missing resolution data for *x compilation terminated. lto-wrapper: fatal error: gcc returned 1 exit status compilation terminated. /usr/bin/ld: error: lto-wrapper failed collect2: error: ld returned 1 exit status Compiling without -flto works as expected. GCC versions tested are 9.3.0 and 11.1.0 on Ubuntu 20.04.