From d30bde36d5b7a7ad74176ddf9ede4d7eb2bca86b Mon Sep 17 00:00:00 2001
From: Anup Patel <anup.patel@wdc.com>
Date: Wed, 22 Dec 2021 18:01:23 +0530
Subject: firmware: Move memcpy/memset mapping to fw_base.S

Some of the external firmwares using OpenSBI as library are facing
issues with the weak memcpy() and memset() aliases in libsbi.a so
we move these to fw_base.S. This way mapping of implicit memcpy()
or memset() calls to sbi_memcpy() or sbi_memset() will only be done
for OpenSBI firmwares.
(Refer, https://github.com/riscv-software-src/opensbi/issues/234)

In addition, we also add memmove() and memcmp() mappings in fw_base.S
because as-per the GCC documentation the freestanding environment must
provide memcpy(), memmove(), memset(), and memcmp().

Signed-off-by: Anup Patel <anup.patel@wdc.com>
Reviewed-by: Atish Patra <atishp@rivosinc.com>
---
 lib/sbi/sbi_string.c | 6 ------
 1 file changed, 6 deletions(-)

(limited to 'lib')

diff --git a/lib/sbi/sbi_string.c b/lib/sbi/sbi_string.c
index c67c02e..c87bce9 100644
--- a/lib/sbi/sbi_string.c
+++ b/lib/sbi/sbi_string.c
@@ -122,9 +122,6 @@ void *sbi_memset(void *s, int c, size_t count)
 	return s;
 }
 
-void *memset(void *s, int c, size_t count) \
-__attribute__((weak, alias("sbi_memset")));
-
 void *sbi_memcpy(void *dest, const void *src, size_t count)
 {
 	char *temp1	  = dest;
@@ -138,9 +135,6 @@ void *sbi_memcpy(void *dest, const void *src, size_t count)
 	return dest;
 }
 
-void *memcpy(void *dest, const void *src, size_t count) \
-__attribute__((weak, alias("sbi_memcpy")));
-
 void *sbi_memmove(void *dest, const void *src, size_t count)
 {
 	char *temp1	  = (char *)dest;
-- 
cgit v1.2.3