This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: 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, 7 Apr 2014 15:29:37 +0400
- Subject: Re: GCC LTO fails static linking while builtins are enabled
- Authentication-results: sourceware.org; auth=none
- References: <CAE0q-EPODFtWhEqbC5HngYXsVaCZL1-ryQ4UgQy7W1571kaCcg at mail dot gmail dot com>
Ping.
This problem still be actual.
On Mon, Mar 24, 2014 at 1:25 PM, Grigoriy Kraynov
<grigoriy.kraynov@gmail.com> wrote:
> 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
--
Regards
Grigoriy Kraynov