[PATCH] D153938: [llvm-exegesis] Adjust GLIBC_INITS_RSEQ condition

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 21:44:37 PDT 2023


MaskRay created this revision.
MaskRay added reviewers: aidengrossman, courbet, SixWeining, xen0n.
Herald added subscribers: mstojanovic, steven.zhang, pengfei, s.egerton, PkmX, atanasyan, simoncook, kristof.beyls, krytarowski, arichardson, sdardis.
Herald added a project: All.
MaskRay requested review of this revision.
Herald added subscribers: llvm-commits, wangpc.
Herald added a project: LLVM.

Commit 9f80831f3627e800709e2434bbbd5bb179b1576e <https://reviews.llvm.org/rG9f80831f3627e800709e2434bbbd5bb179b1576e> 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153938

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


Index: llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
===================================================================
--- llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -21,6 +21,7 @@
 #include "llvm/ADT/StringExtras.h"
 #include "llvm/ADT/StringRef.h"
 #include "llvm/ADT/Twine.h"
+#include "llvm/Support/Compiler.h"
 #include "llvm/Support/CrashRecoveryContext.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/FileSystem.h"
@@ -38,16 +39,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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153938.535231.patch
Type: text/x-patch
Size: 945 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230628/1183b5b3/attachment.bin>


More information about the llvm-commits mailing list