GCC LTO fails static linking while builtins are enabled

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux