summaryrefslogtreecommitdiff
path: root/bolt
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@acm.org>2023-04-19 16:07:25 -0400
committerNathan Sidwell <nathan@acm.org>2023-04-21 12:37:54 -0400
commit1c3653df0841a755dc3d63791f0e9569da68e5c2 (patch)
tree4c6ba453c691168d2cd4c399ff619e357dfcf166 /bolt
parentff46b844165f7b611548333c77246244ec21e104 (diff)
downloadllvm-1c3653df0841a755dc3d63791f0e9569da68e5c2.tar.gz
[BOLT] Robustify compile-time config check
The BOLT runtime is specifically hard coded for x86_64 linux or x86_64 darwin. (Using x86_64 syscalls, hardcoding syscall numbers.) Make it very clear this is for those specific pair of systems. Reviewed By: rafauler Differential Revision: https://reviews.llvm.org/D148825
Diffstat (limited to 'bolt')
-rw-r--r--bolt/runtime/common.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/bolt/runtime/common.h b/bolt/runtime/common.h
index 58b8114713d6..de11e44120a2 100644
--- a/bolt/runtime/common.h
+++ b/bolt/runtime/common.h
@@ -6,7 +6,11 @@
//
//===----------------------------------------------------------------------===//
-#if !defined(__APPLE__)
+#if !defined(__x86_64__)
+#error "For x86_64 only"
+#endif
+
+#if defined(__linux__)
#include <cstddef>
#include <cstdint>
@@ -17,7 +21,7 @@
#include <elf.h>
#endif
-#else
+#elif defined(__APPLE__)
typedef __SIZE_TYPE__ size_t;
#define __SSIZE_TYPE__ \
@@ -36,6 +40,8 @@ typedef unsigned char uint8_t;
typedef long long int64_t;
typedef int int32_t;
+#else
+#error "For Linux or MacOS only"
#endif
// Save all registers while keeping 16B stack alignment