[llvm-exegesis] Adjust GLIBC_INITS_RSEQ condition
authorFangrui Song <i@maskray.me>
Wed, 28 Jun 2023 07:23:38 +0000 (00:23 -0700)
committerFangrui Song <i@maskray.me>
Wed, 28 Jun 2023 07:23:38 +0000 (00:23 -0700)
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

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

index a5ea0fa..6d0b754 100644 (file)
 #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 {