diff options
Diffstat (limited to 'libc')
| -rw-r--r-- | libc/cmake/modules/LLVMLibCCompileOptionRules.cmake | 8 | ||||
| -rw-r--r-- | libc/include/llvm-libc-macros/gpu/signal-macros.h | 9 | ||||
| -rw-r--r-- | libc/include/llvm-libc-macros/linux/signal-macros.h | 9 | ||||
| -rw-r--r-- | libc/src/setjmp/x86_64/sigsetjmp.cpp | 3 | ||||
| -rw-r--r-- | libc/src/string/CMakeLists.txt | 11 |
5 files changed, 22 insertions, 18 deletions
diff --git a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake index 4c36ed8..4e9a9b66 100644 --- a/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake +++ b/libc/cmake/modules/LLVMLibCCompileOptionRules.cmake @@ -81,6 +81,14 @@ function(_get_compile_options_from_config output_var) list(APPEND config_options "-DLIBC_QSORT_IMPL=${LIBC_CONF_QSORT_IMPL}") endif() + if(LIBC_CONF_STRING_UNSAFE_WIDE_READ) + list(APPEND config_options "-DLIBC_COPT_STRING_UNSAFE_WIDE_READ") + endif() + + if(LIBC_CONF_MEMSET_X86_USE_SOFTWARE_PREFETCHING) + list(APPEND config_options "-DLIBC_COPT_MEMSET_X86_USE_SOFTWARE_PREFETCHING") + endif() + if(LIBC_TYPES_TIME_T_IS_32_BIT AND LLVM_LIBC_FULL_BUILD) list(APPEND config_options "-DLIBC_TYPES_TIME_T_IS_32_BIT") endif() diff --git a/libc/include/llvm-libc-macros/gpu/signal-macros.h b/libc/include/llvm-libc-macros/gpu/signal-macros.h index f0d49ea..76488e9 100644 --- a/libc/include/llvm-libc-macros/gpu/signal-macros.h +++ b/libc/include/llvm-libc-macros/gpu/signal-macros.h @@ -9,6 +9,8 @@ #ifndef LLVM_LIBC_MACROS_GPU_SIGNAL_MACROS_H #define LLVM_LIBC_MACROS_GPU_SIGNAL_MACROS_H +#include "__llvm-libc-common.h" + #define SIGINT 2 #define SIGILL 4 #define SIGABRT 6 @@ -16,9 +18,10 @@ #define SIGSEGV 11 #define SIGTERM 15 -#define SIG_DFL ((void (*)(int))(0)) -#define SIG_IGN ((void (*)(int))(1)) -#define SIG_ERR ((void (*)(int))(-1)) +#define SIG_ERR __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), -1) +#define SIG_DFL __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 0) +#define SIG_IGN __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 1) +#define SIG_HOLD __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 2) // Max signal number #define NSIG 64 diff --git a/libc/include/llvm-libc-macros/linux/signal-macros.h b/libc/include/llvm-libc-macros/linux/signal-macros.h index d220241..e7f268d 100644 --- a/libc/include/llvm-libc-macros/linux/signal-macros.h +++ b/libc/include/llvm-libc-macros/linux/signal-macros.h @@ -9,6 +9,8 @@ #ifndef LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H #define LLVM_LIBC_MACROS_LINUX_SIGNAL_MACROS_H +#include "__llvm-libc-common.h" + #define SIGHUP 1 #define SIGINT 2 #define SIGQUIT 3 @@ -86,9 +88,10 @@ #error "Signal stack sizes not defined for your platform." #endif -#define SIG_DFL ((void (*)(int))0) -#define SIG_IGN ((void (*)(int))1) -#define SIG_ERR ((void (*)(int))(-1)) +#define SIG_ERR __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), -1) +#define SIG_DFL __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 0) +#define SIG_IGN __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 1) +#define SIG_HOLD __LLVM_LIBC_CAST(reinterpret_cast, void (*)(int), 2) // SIGCHLD si_codes #define CLD_EXITED 1 // child has exited diff --git a/libc/src/setjmp/x86_64/sigsetjmp.cpp b/libc/src/setjmp/x86_64/sigsetjmp.cpp index 4c97a01..2bad053 100644 --- a/libc/src/setjmp/x86_64/sigsetjmp.cpp +++ b/libc/src/setjmp/x86_64/sigsetjmp.cpp @@ -41,7 +41,7 @@ LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf buf)) { [epilogue] "X"(sigsetjmp_epilogue) : "eax", "ebx", "ecx"); } -#endif +#else [[gnu::naked]] LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf, int)) { asm(R"( @@ -64,5 +64,6 @@ LLVM_LIBC_FUNCTION(int, sigsetjmp, (sigjmp_buf, int)) { [epilogue] "X"(sigsetjmp_epilogue) : "rax", "rbx"); } +#endif } // namespace LIBC_NAMESPACE_DECL diff --git a/libc/src/string/CMakeLists.txt b/libc/src/string/CMakeLists.txt index 83c9564..a640e1d 100644 --- a/libc/src/string/CMakeLists.txt +++ b/libc/src/string/CMakeLists.txt @@ -1,15 +1,5 @@ add_subdirectory(memory_utils) -if(LIBC_CONF_STRING_UNSAFE_WIDE_READ) - list(APPEND string_config_options "-DLIBC_COPT_STRING_UNSAFE_WIDE_READ") -endif() -if(LIBC_CONF_MEMSET_X86_USE_SOFTWARE_PREFETCHING) - list(APPEND string_config_options "-DLIBC_COPT_MEMSET_X86_USE_SOFTWARE_PREFETCHING") -endif() -if(string_config_options) - list(PREPEND string_config_options "COMPILE_OPTIONS") -endif() - add_header_library( string_utils HDRS @@ -24,7 +14,6 @@ add_header_library( libc.src.__support.common libc.src.__support.macros.attributes libc.src.string.memory_utils.inline_memcpy - ${string_config_options} ) add_header_library( |
