This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GCC LTO fails static linking while builtins are enabled


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 Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]