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

Brad Smith via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 7 12:04:39 PDT 2025


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

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

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

Closes: #125566

>From 3ec7689ddc63ece6646536917a5ec1d519c90d46 Mon Sep 17 00:00:00 2001
From: Thomas Klausner <wiz at gatalith.at>
Date: Mon, 7 Apr 2025 14:59:41 -0400
Subject: [PATCH] [sanitizer_common] Fix building with NetBSD 10.99.12 or newer

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

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

Closes: #125566
---
 .../lib/sanitizer_common/sanitizer_linux_libcdep.cpp      | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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()



More information about the llvm-commits mailing list