diff --git a/libc/cmake/modules/LLVMLibCLibraryRules.cmake b/libc/cmake/modules/LLVMLibCLibraryRules.cmake --- a/libc/cmake/modules/LLVMLibCLibraryRules.cmake +++ b/libc/cmake/modules/LLVMLibCLibraryRules.cmake @@ -136,7 +136,7 @@ "ADD_HEADER" "" # No optional arguments "" # No Single value arguments - "HDRS;DEPENDS" # Multi-value arguments + "HDRS;DEPENDS;COMPILE_OPTIONS" # Multi-value arguments ${ARGN} ) @@ -161,6 +161,9 @@ if(ADD_HEADER_DEPENDS) add_dependencies(${interface_target_name} ${fq_deps_list}) endif() + if(ADD_HEADER_COMPILE_OPTIONS) + target_compile_options(${interface_target_name} INTERFACE ${ADD_HEADER_COMPILE_OPTIONS}) + endif() add_custom_target(${fq_target_name}) add_dependencies(${fq_target_name} ${interface_target_name}) diff --git a/libc/src/string/memory_utils/CMakeLists.txt b/libc/src/string/memory_utils/CMakeLists.txt --- a/libc/src/string/memory_utils/CMakeLists.txt +++ b/libc/src/string/memory_utils/CMakeLists.txt @@ -15,6 +15,8 @@ memcpy_implementations.h DEPS .memory_utils + COMPILE_OPTIONS + "-fno-builtin-memcpy" ) add_header_library( diff --git a/libc/src/string/memory_utils/elements.h b/libc/src/string/memory_utils/elements.h --- a/libc/src/string/memory_utils/elements.h +++ b/libc/src/string/memory_utils/elements.h @@ -511,8 +511,6 @@ // __builtin_memcpy_inline guarantees to never call external functions. // Unfortunately it is not widely available. __builtin_memcpy_inline(dst, src, SIZE); -#elif __has_builtin(__builtin_memcpy) - __builtin_memcpy(dst, src, SIZE); #else for_loop_copy(dst, src); #endif