[llvm] 46b5b85 - [llvm-exegesis] Adjust GLIBC_INITS_RSEQ condition

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 28 00:23:43 PDT 2023


Author: Fangrui Song
Date: 2023-06-28T00:23:38-07:00
New Revision: 46b5b855489f87aac2487d099175807880486041

URL: https://github.com/llvm/llvm-project/commit/46b5b855489f87aac2487d099175807880486041
DIFF: https://github.com/llvm/llvm-project/commit/46b5b855489f87aac2487d099175807880486041.diff

LOG: [llvm-exegesis] Adjust GLIBC_INITS_RSEQ condition

Commit 9f80831f3627e800709e2434bbbd5bb179b1576e introduced `#include <sys/rseq.h>`,
but RSEQ_SIG is only defined by some glibc ports (aarch64,arm,mips,powerpc,s390,x86),
causing other hosts (e.g., riscv64, loongarch64) to fail to build.

Reviewed By: aidengrossman, xen0n

Differential Revision: https://reviews.llvm.org/D153938

Added: 
    

Modified: 
    llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index a5ea0fa1b20ff..6d0b754a7c899 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -38,16 +38,13 @@
 #include <sys/wait.h>
 #include <unistd.h>
 
-#ifdef __GLIBC__
-#if __GLIBC_MINOR__ >= 35
-#define GLIBC_INITS_RSEQ
-#endif // __GLIBC__MINOR > 35
-#endif // __GLIBC__
-
-#ifdef GLIBC_INITS_RSEQ
+#if defined(__GLIBC__) && __has_include(<sys/rseq.h>)
 #include <sys/rseq.h>
-#endif // HAS_RSEQ
-#endif // __linux__
+#ifdef RSEQ_SIG
+#define GLIBC_INITS_RSEQ
+#endif
+#endif
+#endif
 
 namespace llvm {
 namespace exegesis {


        


More information about the llvm-commits mailing list