This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
link errors with -flto and -Wl,-soname,f.o
- From: Jay Foad <jay dot foad at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Wed, 9 Apr 2014 12:01:18 +0100
- Subject: link errors with -flto and -Wl,-soname,f.o
- Authentication-results: sourceware.org; auth=none
With GCC 4.9 (built from svn r209238 on Linux x86-64) I'm getting these errors:
$ echo "void f() {}" > f.c
$ gcc -flto -c f.c
$ gcc -flto -o f.so -shared -Wl,-soname,f.o f.o
f.c:1:6: error: 'f' has already been defined
void f() {}
^
f.c:1:6: note: previously defined here
lto1: fatal error: errors during merging of translation units
compilation terminated.
lto-wrapper: /home/jay/gcc/local/bin/gcc returned 1 exit status
collect2: error: lto-wrapper returned 1 exit status
I realise that setting the soname to f.o (instead of f.so) is an odd
thing to do, but I don't see why it should provoke these errors.
I don't see the errors with GCC 4.8.1 (at least the version of it
supplied with Ubuntu 13.10).
Thanks,
Jay.