https://sourceware.org/bugzilla/show_bug.cgi?id=23350

--- Comment #6 from Martin Liska <mliska at suse dot cz> ---
Sorry for not precise reproducer. I was reducing that from an existing package
that normally succeeds w/o LTO.

So what about this:

$ cat main.i
int wrl;

int main ()
{
  return 0;
}

$ cat lib.i
int wrl;
void a() {}

$ gcc -c main.i && gcc -c lib.i && ar rusc lib.a lib.o && gcc main.o lib.a
lib.a

This works fine, however:

$ gcc -c -flto main.i && gcc -c -flto lib.i && ar rusc lib.a lib.o && gcc
main.o lib.a lib.a -flto --save-temps
lto1: fatal error: multiple prevailing defs for ‘a’
compilation terminated.
lto-wrapper: fatal error: gcc returned 1 exit status
compilation terminated.
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: error:
lto-wrapper failed
collect2: error: ld returned 1 exit status

$ cat lib.res
3
main.o 2
198 5dfd76773c77e89 PREVAILING_DEF main
202 5dfd76773c77e89 PREVAILING_DEF_IRONLY wrl
lib.a@0x92 2
198 e65cc6ac1d79da7a PREVAILING_DEF_IRONLY a
202 e65cc6ac1d79da7a RESOLVED_IR wrl
lib.a@0x92 2
198 e65cc6ac1d79da7a PREVAILING_DEF_IRONLY a
202 e65cc6ac1d79da7a RESOLVED_IR wrl

Hope it's fine test-case?

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils

Reply via email to