[libc-commits] [libc] [libc] Change LIBC_THREAD_LOCAL to be dependent on LIBC_THREAD_MODE (PR #151527)

via libc-commits libc-commits at lists.llvm.org
Thu Jul 31 07:29:37 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: William Huynh (saturn691)

<details>
<summary>Changes</summary>

This allows baremetal builds to avoid using thread_local. However, libcxx may be affected by this.

---
Full diff: https://github.com/llvm/llvm-project/pull/151527.diff


1 Files Affected:

- (modified) libc/src/__support/macros/attributes.h (+1-1) 


``````````diff
diff --git a/libc/src/__support/macros/attributes.h b/libc/src/__support/macros/attributes.h
index c6474673de85a..23f973827b6f9 100644
--- a/libc/src/__support/macros/attributes.h
+++ b/libc/src/__support/macros/attributes.h
@@ -28,7 +28,7 @@
 #define LIBC_INLINE_ASM __asm__ __volatile__
 #define LIBC_UNUSED __attribute__((unused))
 
-#ifdef LIBC_TARGET_ARCH_IS_GPU
+#if LIBC_THREAD_MODE == LIBC_THREAD_MODE_SINGLE
 #define LIBC_THREAD_LOCAL
 #else
 #define LIBC_THREAD_LOCAL thread_local

``````````

</details>


https://github.com/llvm/llvm-project/pull/151527


More information about the libc-commits mailing list