From 2c471a89d05a75568680e0b0436e9d36140c768b Mon Sep 17 00:00:00 2001 From: Bananymous Date: Wed, 17 Jan 2024 19:44:29 +0100 Subject: [PATCH] LibC: Add compile option to libc to stop optimizing string.h --- libc/CMakeLists.txt | 2 +- libc/string.cpp | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/libc/CMakeLists.txt b/libc/CMakeLists.txt index 3b2d634d..25ed0171 100644 --- a/libc/CMakeLists.txt +++ b/libc/CMakeLists.txt @@ -48,7 +48,7 @@ add_custom_target(crtx-install add_library(libc ${LIBC_SOURCES}) add_dependencies(libc headers crtx-install) -target_compile_options(libc PRIVATE -O2 -g -Wstack-usage=512) +target_compile_options(libc PRIVATE -O2 -g -Wstack-usage=512 -fno-tree-loop-distribute-patterns) target_compile_options(libc PUBLIC -Wall -Wextra -Werror -Wno-error=stack-usage=) add_custom_target(libc-install diff --git a/libc/string.cpp b/libc/string.cpp index 56403014..6c91c1d2 100644 --- a/libc/string.cpp +++ b/libc/string.cpp @@ -17,7 +17,6 @@ int memcmp(const void* s1, const void* s2, size_t n) return 0; } -__attribute__((optimize("-O0"))) void* memcpy(void* __restrict__ dstp, const void* __restrict__ srcp, size_t n) { unsigned char* dst = static_cast(dstp); @@ -46,7 +45,6 @@ void* memmove(void* destp, const void* srcp, size_t n) return destp; } -__attribute__((optimize("-O0"))) void* memset(void* s, int c, size_t n) { unsigned char* p = static_cast(s);