Hit this while attempting to compile a large code base with WHOPR: tweak1.c: void y(void) { printf("y\n"); } void x(void) __attribute__((weak, alias("y")));
tweak2.c: void x(void) { printf("strong\n"); } tweak3.c: extern void x(void); int main(void) { x(); return 0; } Compile with gcc -fwhopr -c -O2 tweak1.c gcc -fwhopr -c -O2 tweak2.c gcc -fwhopr -c -O2 tweak3.c gcc -fwhopr tweak[123].o /tmp/ccGG7BOa.ltrans1.ltrans.o: In function `x': ccGG7BOa.ltrans1.o:(.text+0x0): multiple definition of `x' /tmp/ccGG7BOa.ltrans0.ltrans.o:ccGG7BOa.ltrans0.o:(.text+0x0): first defined here collect2: ld returned 1 exit status Without -fwhopr it works Version: Target: x86_64-unknown-linux-gnu Configured with: ../gcc/configure --prefix=/pkg/gcc-4.6-100607 --enable-checking=release --enable-languages=c,c++ --disable-nls --enable-lto --enable-gold --with-plugin-ld=/usr/local/bin/gold --with-elf-include=/usr/include/libelf Thread model: posix gcc version 4.6.0 20100607 (experimental) (GCC) -- Summary: whopr does not work with weak functions Product: gcc Version: lto Status: UNCONFIRMED Severity: normal Priority: P3 Component: lto AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: andi-gcc at firstfloor dot org GCC host triplet: x86_64-linux GCC target triplet: x86_64-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44463