Merge "memset_chk into assembly file"
This commit is contained in:
commit
529c16a678
3 changed files with 15 additions and 10 deletions
|
@ -672,7 +672,6 @@ cc_library_static {
|
|||
},
|
||||
riscv64: {
|
||||
srcs: [
|
||||
"arch-riscv64/string/memset_chk.c",
|
||||
"upstream-freebsd/lib/libc/string/memcmp.c",
|
||||
"upstream-freebsd/lib/libc/string/memcpy.c",
|
||||
"upstream-freebsd/lib/libc/string/memmove.c",
|
||||
|
@ -825,6 +824,11 @@ cc_library_static {
|
|||
"arch-arm64/string/__memset_chk.S",
|
||||
],
|
||||
},
|
||||
riscv64: {
|
||||
srcs: [
|
||||
"arch-riscv64/string/__memset_chk.S",
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
10
libc/arch-riscv64/string/__memset_chk.S
Normal file
10
libc/arch-riscv64/string/__memset_chk.S
Normal file
|
@ -0,0 +1,10 @@
|
|||
#include <private/bionic_asm.h>
|
||||
|
||||
ENTRY(__memset_chk)
|
||||
bleu a2, a3, 1f
|
||||
call __memset_chk_fail
|
||||
|
||||
1:
|
||||
tail memset
|
||||
END(__memset_chk)
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#include <stdint.h>
|
||||
|
||||
extern void* memset(void*, int, size_t);
|
||||
extern void* __memset_chk_fail(void*, int, size_t, size_t);
|
||||
|
||||
void* __memset_chk(void* dst, int c, size_t n, size_t dst_len) {
|
||||
if (dst_len < n) __memset_chk_fail(dst, c, n, dst_len);
|
||||
return memset(dst, c, n);
|
||||
}
|
Loading…
Reference in a new issue