This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
GCC LTO fails static linking while builtins are enabled
- From: Grigoriy Kraynov <grigoriy dot kraynov at gmail dot com>
- To: gcc-help at gcc dot gnu dot org
- Cc: aivchenk at gmail dot com
- Date: Mon, 24 Mar 2014 13:25:18 +0400
- Subject: GCC LTO fails static linking while builtins are enabled
- Authentication-results: sourceware.org; auth=none
GCC LTO fails static linking while builtins are enabled
Minimal case:
#include <stddef.h>
int memcmp(const char *s1, const char *s2, size_t n) {
return 0;
}
int main() {
memcmp("x", "y", 1);
return 0;
}
$ gcc -flto -static
fails with message like this:
xxx.ltrans.o: In function `memcmp':
xxx.ltrans0.o:(.text+0x0): multiple definition of `memcmp'
/zzz/libc.a(memcmp.o):(.text+0x0): first defined here
collect2: error: ld returned 1 exit status
But -fno-builtin solves this problem.
If we have function defined as weak alias in static libc (like
strncasecmp() in GlibC) there is no problem.
Is there any way to ignore libc's symbols redefinition without hacks
like disabling builtins or enabling multiple definition?
--
Regards
Grigoriy Kraynov