[llvm] [llvm-exegesis] Fix musl build (PR #147954)

via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 06:01:48 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-tools-llvm-exegesis

Author: Nikita Popov (nikic)

<details>
<summary>Changes</summary>

We should not include both linux/prctl.h and sys/prctl.h. This works with glibc because the latter includes the former, but breaks with musl because the latter redeclares the contents of the former, resulting in:

    /usr/local/aarch64-linux-musl/include/sys/prctl.h:88:8: error: redefinition of 'struct prctl_mm_map'
       88 | struct prctl_mm_map {
          |        ^~~~~~~~~~~~
    In file included from /checkout/src/llvm-project/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp:13:
    /usr/local/aarch64-linux-musl/include/linux/prctl.h:134:8: note: previous definition of 'struct prctl_mm_map'
      134 | struct prctl_mm_map {
          |        ^~~~~~~~~~~~

Fixes https://github.com/llvm/llvm-project/issues/139443.

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


1 Files Affected:

- (modified) llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp (+1-2) 


``````````diff
diff --git a/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp b/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp
index d6f4c5220f71d..3a0021e3c132d 100644
--- a/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/AArch64/Target.cpp
@@ -10,8 +10,7 @@
 #include "AArch64RegisterInfo.h"
 
 #if defined(__aarch64__) && defined(__linux__)
-#include <linux/prctl.h> // For PR_PAC_* constants
-#include <sys/prctl.h>
+#include <sys/prctl.h> // For PR_PAC_* constants
 #ifndef PR_PAC_APIAKEY
 #define PR_PAC_APIAKEY (1UL << 0)
 #endif

``````````

</details>


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


More information about the llvm-commits mailing list