[Bug lto/47181] New: memops-asm testcase fails with -flto -fuse-linker-plugin
hubicka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 5 15:08:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47181
Summary: memops-asm testcase fails with -flto
-fuse-linker-plugin
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hubicka@gcc.gnu.org
memops-asm testcase fails with -flto -fuse-linker-plugin. We produce undefined
call to my_memcpy:
evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# ./xgcc -B ./ -O2 memops-asm*.c
/abuild/jh/trunk-3/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c -g
-O0 -flto --save-temps -fdump-ipa-all-details -save-temps
memops-asm.c: In function ?main_test?:
memops-asm.c:37:3: warning: incompatible implicit declaration of built-in
function ?printf? [enabled by default]
[Leaving LTRANS /tmp/ccrBB4II.args]
[Leaving LTRANS /tmp/ccc7Rjx0.ltrans.out]
[Leaving LTRANS /tmp/ccOzcZ98.args]
[Leaving LTRANS /tmp/ccc7Rjx0.ltrans0.o]
evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# grep memcpy *.s
ccc7Rjx0.ltrans0.s: .globl memcpy
ccc7Rjx0.ltrans0.s: .type memcpy, @function
ccc7Rjx0.ltrans0.s:memcpy:
ccc7Rjx0.ltrans0.s: call my_memcpy.2055
ccc7Rjx0.ltrans0.s: .size memcpy, .-memcpy
ccc7Rjx0.ltrans0.s: .type my_memcpy.2055, @function
ccc7Rjx0.ltrans0.s:my_memcpy.2055:
ccc7Rjx0.ltrans0.s: .size my_memcpy.2055, .-my_memcpy.2055
ccc7Rjx0.ltrans0.s: call my_memcpy
ccc7Rjx0.ltrans0.s: call my_memcpy
ccc7Rjx0.ltrans0.s: .string "memcpy"
ccc7Rjx0.ltrans0.s: .string "my_memcpy"
the issue is that my_memcpy is declared once as:
extern void *memcpy (void *, const void *, size_t)
__asm (ASMNAME ("my_memcpy"));
and in the other unit as
void *
my_memcpy (void *d, const void *s, size_t n)
we fail to merge the declarations in lto-symtab since builtins are streamed in
special way. This leads to linker bug and wrong code:
http://sourceware.org/bugzilla/show_bug.cgi?id=12365
More information about the Gcc-bugs
mailing list