From 255e634bf71a2e7cf128c93090717183fba1666a Mon Sep 17 00:00:00 2001 From: Alex Brachet Date: Sat, 28 Mar 2020 02:59:42 -0400 Subject: [PATCH] [libc][NFC] Ensure internal implementation is in __llvm_libc namespace Summary: In preparation for D76818. Reviewers: PaulkaToast, sivachandra, gchatelet Reviewed By: PaulkaToast, sivachandra Subscribers: MaskRay, tschuett, libc-commits Differential Revision: https://reviews.llvm.org/D76967 --- libc/src/signal/linux/__restore.cpp | 4 ++++ libc/src/string/memory_utils/memcpy_utils.h | 4 ++-- libc/src/threads/linux/thread_utils.h | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/libc/src/signal/linux/__restore.cpp b/libc/src/signal/linux/__restore.cpp index bfdee4b..8d99d6a 100644 --- a/libc/src/signal/linux/__restore.cpp +++ b/libc/src/signal/linux/__restore.cpp @@ -13,8 +13,12 @@ #include "config/linux/syscall.h" #include "include/sys/syscall.h" +namespace __llvm_libc { + extern "C" void __restore_rt() __attribute__((no_sanitize("thread", "memory", "undefined", "fuzzer"), hidden)); extern "C" void __restore_rt() { __llvm_libc::syscall(SYS_rt_sigreturn); } + +} // namespace __llvm_libc diff --git a/libc/src/string/memory_utils/memcpy_utils.h b/libc/src/string/memory_utils/memcpy_utils.h index c69e557..7975d47 100644 --- a/libc/src/string/memory_utils/memcpy_utils.h +++ b/libc/src/string/memory_utils/memcpy_utils.h @@ -20,14 +20,14 @@ #define USE_BUILTIN_MEMCPY #endif +namespace __llvm_libc { + // This is useful for testing. #if defined(LLVM_LIBC_MEMCPY_MONITOR) extern "C" void LLVM_LIBC_MEMCPY_MONITOR(char *__restrict, const char *__restrict, size_t); #endif -namespace __llvm_libc { - // Copies `kBlockSize` bytes from `src` to `dst`. template static void Copy(char *__restrict dst, const char *__restrict src) { diff --git a/libc/src/threads/linux/thread_utils.h b/libc/src/threads/linux/thread_utils.h index e9dfb4c..37198ad 100644 --- a/libc/src/threads/linux/thread_utils.h +++ b/libc/src/threads/linux/thread_utils.h @@ -14,6 +14,8 @@ #include #include +namespace __llvm_libc { + // The futex data has to be exactly 4 bytes long. However, we use a uint type // here as we do not want to use `_Atomic uint32_t` as the _Atomic keyword which // is C only. The header stdatomic.h does not define an atomic type @@ -35,4 +37,6 @@ struct ThreadParams { static constexpr uint32_t ClearTIDValue = 0xABCD1234; }; +} // namespace __llvm_libc + #endif // LLVM_LIBC_SRC_THREADS_LINUX_THREAD_UTILS_H -- 2.7.4