gbl: remove unused riscv libc implementations
Test: build
Bug: 349352647
Change-Id: I9b0cfffcae7008f44b3734adcbf341d06ea3f668
Signed-off-by: Dmitrii Merkurev <dimorinny@google.com>
diff --git a/gbl/efi/arch/riscv64/deps.cpp b/gbl/efi/arch/riscv64/deps.cpp
index 3ce5be4..23b3317 100644
--- a/gbl/efi/arch/riscv64/deps.cpp
+++ b/gbl/efi/arch/riscv64/deps.cpp
@@ -14,62 +14,12 @@
* limitations under the License.
*/
-#include <stddef.h>
#include <stdint.h>
#include "elf/relocation.h"
-// Following are naive implementations of functions in <string.h> that are not
-// provided by the toolchain for RISC-V targets. They are simply for getting
-// compilation passed and not necessarily optimzied.
extern "C" {
-int memcmp(const void* s1, const void* s2, size_t count) {
- const uint8_t* left = static_cast<const uint8_t*>(s1);
- const uint8_t* right = static_cast<const uint8_t*>(s2);
- for (size_t i = 0; i < count; i++) {
- if (left[i] == right[i]) {
- continue;
- }
- return left[i] < right[i] ? -1 : 1;
- }
- return 0;
-}
-
-void* memmove(void* dest, void const* src, size_t count) {
- uint8_t* _dest = static_cast<uint8_t*>(dest);
- const uint8_t* _src = static_cast<const uint8_t*>(src);
- if (dest < src) {
- for (size_t i = 0; i < count; i++) {
- _dest[i] = _src[i];
- }
- } else {
- for (size_t i = count; i > 0; i--) {
- _dest[i - 1] = _src[i - 1];
- }
- }
- return dest;
-}
-
-size_t strlen(const char* str) {
- size_t i = 0;
- for (; str[i] != 0; i++) {
- }
- return i;
-}
-
-void* memset(void* ptr, int value, size_t num) {
- uint8_t* start = static_cast<uint8_t*>(ptr);
- for (size_t i = 0; i < num; i++) {
- start[i] = value;
- }
- return ptr;
-}
-
-void* memcpy(void* dest, const void* src, size_t num) {
- return memmove(dest, src, num);
-}
-
void ApplyRelocationHangIfFail(uintptr_t program_base, uintptr_t dynamic_section) {
if (!ApplyRelocation(program_base, dynamic_section)) {
while (true) {