[compiler-rt] [compiler-rt] Fix linux header includes for musl with old kernels (PR #150621)

Caleb Zulawski via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 25 07:41:06 PDT 2025


https://github.com/calebzulawski updated https://github.com/llvm/llvm-project/pull/150621

>From 1dcaf62c80b842b14baa7686795cd849fe96b1b7 Mon Sep 17 00:00:00 2001
From: Caleb Zulawski <caleb.zulawski at gmail.com>
Date: Fri, 25 Jul 2025 01:31:35 -0400
Subject: [PATCH] [compiler-rt] Fix linux header includes for musl with old
 kernels

---
 .../sanitizer_common/sanitizer_platform_limits_posix.cpp  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
index ef4b8a85d6634..4c96b6ac0c28c 100644
--- a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -72,8 +72,6 @@
 #include <malloc.h>
 #include <mntent.h>
 #include <netinet/ether.h>
-#include <sys/sysinfo.h>
-#include <sys/vt.h>
 #include <linux/cdrom.h>
 #include <linux/fd.h>
 #if SANITIZER_ANDROID
@@ -87,6 +85,10 @@
 #include <linux/utsname.h>
 #include <linux/posix_types.h>
 #include <net/if_arp.h>
+#ifndef _LINUX_SYSINFO_H
+#include <sys/sysinfo.h>
+#endif
+#include <sys/vt.h>
 #endif
 
 #if SANITIZER_IOS
@@ -133,9 +135,9 @@ typedef struct user_fpregs elf_fpregset_t;
 #      endif
 #      include <scsi/scsi.h>
 #else
+#include <linux/ppp_defs.h>
 #include <linux/if_ppp.h>
 #include <linux/kd.h>
-#include <linux/ppp_defs.h>
 #endif  // SANITIZER_GLIBC
 
 #if SANITIZER_ANDROID



More information about the llvm-commits mailing list