diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2017-11-29 05:13:58 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2017-11-29 05:13:58 +0000 |
commit | aeccbd44f9c3c13e18a62f78e7d5eec72cec27c2 (patch) | |
tree | 0b8f1ec0ff076aa5eae382b4801ed399cd43d5b5 /lib/libc/arch/amd64/string | |
parent | 91a797ffb7ddec4e824bd9414f45fd9cfa8503c6 (diff) |
clang doesn't propagate attributes like "asm labels" and "visibility(hidden)"
to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when
building with clang, instead mark those as protected visibility to get rid
of the PLT relocations. We can't take the address of them then, but that's
ok: it's a build-time error not a run-time error.
ok kettenis@
Diffstat (limited to 'lib/libc/arch/amd64/string')
-rw-r--r-- | lib/libc/arch/amd64/string/memmove.S | 10 | ||||
-rw-r--r-- | lib/libc/arch/amd64/string/memset.S | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/lib/libc/arch/amd64/string/memmove.S b/lib/libc/arch/amd64/string/memmove.S index f0e01654c2f..da244c332a1 100644 --- a/lib/libc/arch/amd64/string/memmove.S +++ b/lib/libc/arch/amd64/string/memmove.S @@ -51,12 +51,14 @@ ENTRY(memmove) subq %rsi,%rax cmpq %rcx,%rax /* overlapping? */ jb 1f +#ifdef memcpy_in_asm jmp 2f /* nope */ -// ENTRY(memcpy) +ENTRY(memcpy) movq %rdi,%r11 /* save dest */ movq %rdx,%rcx 2: +#endif cld /* copy forwards. */ shrq $3,%rcx /* copy by words */ rep @@ -85,6 +87,8 @@ ENTRY(memmove) movq %r11,%rax cld ret -// END(memcpy) -END_STRONG(memmove) +#ifdef memcpy_in_asm +END_BUILTIN(memcpy) +#endif +END_BUILTIN(memmove) END_WEAK(bcopy) diff --git a/lib/libc/arch/amd64/string/memset.S b/lib/libc/arch/amd64/string/memset.S index b3f4ffa17bf..2a8645cb1c3 100644 --- a/lib/libc/arch/amd64/string/memset.S +++ b/lib/libc/arch/amd64/string/memset.S @@ -53,4 +53,4 @@ L1: rep movq %r11,%rax ret -END_STRONG(memset) +END_BUILTIN(memset) |