[compiler-rt] [compiler-rt] Avoid defining _KERNEL on FreeBSD (PR #143116)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 6 04:44:13 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-compiler-rt-sanitizer
Author: Jessica Clarke (jrtc27)
<details>
<summary>Changes</summary>
Defining _KERNEL is a hack that can cause all kinds of breakage if
you're not careful, since the actual environment is not a kernel build,
and so should be avoided. Since FreeBSD 12 (MFC'ed for 11.3) you can
define _WANT_SYSVSHM_INTERNALS to expose shminfo (and various other
things) to userspace, so use that instead.
---
Full diff: https://github.com/llvm/llvm-project/pull/143116.diff
1 Files Affected:
- (modified) compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp (+1-2)
``````````diff
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
index 4940062eeae47..8e83ef9ae61df 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp
@@ -87,9 +87,8 @@
#include <wchar.h>
#include <wordexp.h>
-#define _KERNEL // to declare 'shminfo' structure
+#define _WANT_SYSVSHM_INTERNALS // to declare 'shminfo' structure
#include <sys/shm.h>
-#undef _KERNEL
#undef IOC_DIRMASK
``````````
</details>
https://github.com/llvm/llvm-project/pull/143116
More information about the llvm-commits
mailing list