[compiler-rt] [sanitizer_common] Fix building with NetBSD 10.99.12 or newer (PR #134708)

via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 12:05:11 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Brad Smith (brad0)

<details>
<summary>Changes</summary>

https://github.com/NetBSD/src/commit/16543c49052c820334cffc5c69b2afde18f02458

__lwp_getprivate_fast() was moved to a new arch-specific header file.

Closes: #<!-- -->125566

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


1 Files Affected:

- (modified) compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp (+7-1) 


``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
index e5e79d4e0521c..304d14b20c6d5 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -29,7 +29,13 @@
 #  include "sanitizer_solaris.h"
 
 #  if SANITIZER_NETBSD
-#    define _RTLD_SOURCE  // for __lwp_gettcb_fast() / __lwp_getprivate_fast()
+#    // for __lwp_gettcb_fast() / __lwp_getprivate_fast()
+#    include <sys/param.h>
+#    if defined(__NetBSD_Version__) && (__NetBSD_Version__ >= 1099001200)
+#      include <machine/lwp_private.h>
+#    else
+#      define _RTLD_SOURCE
+#    endif
 #  endif
 
 #  include <dlfcn.h>  // for dlsym()

``````````

</details>


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


More information about the llvm-commits mailing list