[libc-commits] [libc] [libc] Mutex implementation for single-threaded baremetal (PR #145358)

Petr Hosek via libc-commits libc-commits at lists.llvm.org
Tue Jul 29 00:23:25 PDT 2025


================
@@ -29,4 +29,12 @@
 #define LIBC_TARGET_OS_IS_FUCHSIA
 #endif
 
+#if !defined(LIBC_TARGET_OS_IS_FREEBSD) &&                                     \
+    !defined(LIBC_TARGET_OS_IS_ANDROID) &&                                     \
+    !defined(LIBC_TARGET_OS_IS_LINUX) &&                                       \
+    !defined(LIBC_TARGET_OS_IS_WINDOWS) &&                                     \
+    !defined(LIBC_TARGET_OS_IS_FUCHSIA) && defined(__ELF__)
+#define LIBC_TARGET_OS_IS_BAREMETAL
+#endif
----------------
petrhosek wrote:

This is error-prone, every time libc is ported to a new OS, we would need to update this list otherwise the baremetal build is going to break ("action at a distance"). I think a better approach would be to pass this value from the build system. I think it'd be also cleaner to introduce this in a separate PR since it's technically unrelated.

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


More information about the libc-commits mailing list