diff options
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/arch-x86_64/string/sse2-memset-slm.S | 35 | ||||
| -rw-r--r-- | libc/bionic/fortify.cpp | 2 |
2 files changed, 12 insertions, 25 deletions
diff --git a/libc/arch-x86_64/string/sse2-memset-slm.S b/libc/arch-x86_64/string/sse2-memset-slm.S index bfcafae07..15253da8a 100644 --- a/libc/arch-x86_64/string/sse2-memset-slm.S +++ b/libc/arch-x86_64/string/sse2-memset-slm.S @@ -28,11 +28,9 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "cache.h" +#include <private/bionic_asm.h> -#ifndef MEMSET -# define MEMSET memset -#endif +#include "cache.h" #ifndef L # define L(label) .L##label @@ -42,30 +40,19 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # define ALIGN(n) .p2align n #endif -#ifndef cfi_startproc -# define cfi_startproc .cfi_startproc -#endif -#ifndef cfi_endproc -# define cfi_endproc .cfi_endproc -#endif +ENTRY(__memset_chk) + # %rdi = dst, %rsi = byte, %rdx = n, %rcx = dst_len + cmp %rdx, %rcx + jl memset -#ifndef ENTRY -# define ENTRY(name) \ - .type name, @function; \ - .globl name; \ -name: \ - cfi_startproc -#endif + # TODO: include __memset_chk_fail in the backtrace? + call PIC_PLT(__memset_chk_fail) +END(__memset_chk) -#ifndef END -# define END(name) \ - cfi_endproc; \ - .size name, .-name -#endif .section .text.sse2,"ax",@progbits -ENTRY (MEMSET) +ENTRY(memset) movq %rdi, %rax #ifdef USE_AS_BZERO_P mov %rsi, %rdx @@ -170,4 +157,4 @@ L(128bytesmore_nt): sfence ret -END (MEMSET) +END(memset) diff --git a/libc/bionic/fortify.cpp b/libc/bionic/fortify.cpp index a1db2a4b4..ccbdec0f3 100644 --- a/libc/bionic/fortify.cpp +++ b/libc/bionic/fortify.cpp @@ -153,7 +153,7 @@ void* __memrchr_chk(const void* s, int c, size_t n, size_t actual_size) { return memrchr(s, c, n); } -#if !defined(__aarch64__) && !defined(__arm__) // TODO: add optimized assembler for the others too. +#if !defined(__aarch64__) && !defined(__arm__) && !defined(__x86_64__) // TODO: add optimized assembler for the others too. // Runtime implementation of __builtin___memset_chk (used directly by compiler, not in headers). extern "C" void* __memset_chk(void* dst, int byte, size_t count, size_t dst_len) { __check_count("memset", "count", count); |
