This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/67220] GCC fails to properly handle libcall symbol visibility of built functions
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 14 Aug 2015 19:31:21 +0000
- Subject: [Bug middle-end/67220] GCC fails to properly handle libcall symbol visibility of built functions
- Auto-submitted: auto-generated
- References: <bug-67220-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67220
H.J. Lu <hjl.tools at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-08-14
Ever confirmed|0 |1
--- Comment #1 from H.J. Lu <hjl.tools at gmail dot com> ---
Inside the same function, one memset is called via PLT and the other
isn't:
[hjl@gnu-6 pr67220]$ cat y.c
typedef __SIZE_TYPE__ size_t;
extern void *memset(void *s, int c, size_t n)
__attribute__ ((visibility ("hidden")));
extern void bar (void *s);
int
foo2 (void *s, int c, size_t n)
{
memset (s, '\0', n);
bar (s);
memset (s, c, n);
return 0;
}
[hjl@gnu-6 pr67220]$ make y.s
/export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -O2 -fPIC -S -o y.s y.c
[hjl@gnu-6 pr67220]$ cat y.s
.file "y.c"
.section .text.unlikely,"ax",@progbits
.LCOLDB0:
.text
.LHOTB0:
.p2align 4,,15
.globl foo2
.type foo2, @function
foo2:
.LFB0:
.cfi_startproc
pushq %r12
.cfi_def_cfa_offset 16
.cfi_offset 12, -16
pushq %rbp
.cfi_def_cfa_offset 24
.cfi_offset 6, -24
movl %esi, %r12d
pushq %rbx
.cfi_def_cfa_offset 32
.cfi_offset 3, -32
xorl %esi, %esi
movq %rdi, %rbx
movq %rdx, %rbp
call memset@PLT <<<< via PLT
movq %rbx, %rdi
call bar@PLT
movq %rbp, %rdx
movl %r12d, %esi
movq %rbx, %rdi
call memset <<<< No PLT
popq %rbx
.cfi_def_cfa_offset 24
xorl %eax, %eax
popq %rbp
.cfi_def_cfa_offset 16
popq %r12
.cfi_def_cfa_offset 8
ret
.cfi_endproc
.LFE0:
.size foo2, .-foo2
.section .text.unlikely
.LCOLDE0:
.text
.LHOTE0:
.hidden memset
.ident "GCC: (GNU) 6.0.0 20150812 (experimental)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 pr67220]$