Skip to content

Commit 1c3653d

Browse files
committed
[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
1 parent ff46b84 commit 1c3653d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

bolt/runtime/common.h

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#if !defined(__APPLE__)
9+
#if !defined(__x86_64__)
10+
#error "For x86_64 only"
11+
#endif
12+
13+
#if defined(__linux__)
1014

1115
#include <cstddef>
1216
#include <cstdint>
@@ -17,7 +21,7 @@
1721
#include <elf.h>
1822
#endif
1923

20-
#else
24+
#elif defined(__APPLE__)
2125

2226
typedef __SIZE_TYPE__ size_t;
2327
#define __SSIZE_TYPE__ \
@@ -36,6 +40,8 @@ typedef unsigned char uint8_t;
3640
typedef long long int64_t;
3741
typedef int int32_t;
3842

43+
#else
44+
#error "For Linux or MacOS only"
3945
#endif
4046

4147
// Save all registers while keeping 16B stack alignment

0 commit comments

Comments
 (0)