summaryrefslogtreecommitdiff
path: root/payloads/libpayload
diff options
context:
space:
mode:
Diffstat (limited to 'payloads/libpayload')
-rw-r--r--payloads/libpayload/libc/memory.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/payloads/libpayload/libc/memory.c b/payloads/libpayload/libc/memory.c
index 4757b10596..5af85389fe 100644
--- a/payloads/libpayload/libc/memory.c
+++ b/payloads/libpayload/libc/memory.c
@@ -34,6 +34,9 @@
#include <libpayload.h>
void *memset(void *s, int c, size_t n)
+ __attribute__((weak, alias("default_memset")));
+
+void *default_memset(void *s, int c, size_t n)
{
char *os = s;
@@ -44,6 +47,9 @@ void *memset(void *s, int c, size_t n)
}
void *memcpy(void *dst, const void *src, size_t n)
+ __attribute__((weak, alias("default_memcpy")));
+
+void *default_memcpy(void *dst, const void *src, size_t n)
{
int i;
void *ret = dst;
@@ -62,6 +68,9 @@ void *memcpy(void *dst, const void *src, size_t n)
}
void *memmove(void *dst, const void *src, size_t n)
+ __attribute__((weak, alias("default_memmove")));
+
+void *default_memmove(void *dst, const void *src, size_t n)
{
int i;
unsigned long offs;
@@ -90,7 +99,11 @@ void *memmove(void *dst, const void *src, size_t n)
* @return If len is 0, return zero. If the areas match, return zero.
* Otherwise return non-zero.
*/
+
int memcmp(const void *s1, const void *s2, size_t len)
+ __attribute__((weak, alias("default_memcmp")));
+
+int default_memcmp(const void *s1, const void *s2, size_t len)
{
for (; len && *(char *)s1++ == *(char *)s2++; len--) ;
return len;