OLD | NEW |
---|---|
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_BASE_BUILD_CONFIG_H_ | 5 #ifndef V8_BASE_BUILD_CONFIG_H_ |
6 #define V8_BASE_BUILD_CONFIG_H_ | 6 #define V8_BASE_BUILD_CONFIG_H_ |
7 | 7 |
8 #include "include/v8config.h" | 8 #include "include/v8config.h" |
9 | 9 |
10 // Processor architecture detection. For more info on what's defined, see: | 10 // Processor architecture detection. For more info on what's defined, see: |
11 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 11 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
12 // http://www.agner.org/optimize/calling_conventions.pdf | 12 // http://www.agner.org/optimize/calling_conventions.pdf |
13 // or with gcc, run: "echo | gcc -E -dM -" | 13 // or with gcc, run: "echo | gcc -E -dM -" |
14 #if defined(_M_X64) || defined(__x86_64__) | 14 #if defined(_M_X64) || defined(__x86_64__) |
15 #if defined(__native_client__) | 15 #if defined(__native_client__) |
16 // For Native Client builds of V8, use V8_TARGET_ARCH_ARM, so that V8 | 16 // For Native Client builds of V8, use V8_TARGET_ARCH_ARM, so that V8 |
17 // generates ARM machine code, together with a portable ARM simulator | 17 // generates ARM machine code, together with a portable ARM simulator |
18 // compiled for the host architecture in question. | 18 // compiled for the host architecture in question. |
19 // | 19 // |
20 // Since Native Client is ILP-32 on all architectures we use | 20 // Since Native Client is ILP-32 on all architectures we use |
21 // V8_HOST_ARCH_IA32 on both 32- and 64-bit x86. | 21 // V8_HOST_ARCH_IA32 on both 32- and 64-bit x86. |
22 #define V8_HOST_ARCH_IA32 1 | 22 #define V8_HOST_ARCH_IA32 1 |
23 #define V8_HOST_ARCH_32_BIT 1 | 23 #define V8_HOST_ARCH_32_BIT 1 |
24 #define V8_HOST_CAN_READ_UNALIGNED 1 | 24 #define V8_HOST_CAN_READ_UNALIGNED 1 |
25 #else | 25 #else |
26 #define V8_HOST_ARCH_X64 1 | 26 #define V8_HOST_ARCH_X64 1 |
27 #if defined(__x86_64__) && !defined(__LP64__) | |
Nico
2014/09/10 16:54:31
Is this the best define you can check for? This no
Nico
2014/09/10 17:44:59
I think __SIZEOF_POINTER__ is a better thing to ch
| |
28 #define V8_HOST_ARCH_32_BIT 1 | |
29 #else | |
27 #define V8_HOST_ARCH_64_BIT 1 | 30 #define V8_HOST_ARCH_64_BIT 1 |
31 #endif | |
28 #define V8_HOST_CAN_READ_UNALIGNED 1 | 32 #define V8_HOST_CAN_READ_UNALIGNED 1 |
29 #endif // __native_client__ | 33 #endif // __native_client__ |
30 #elif defined(_M_IX86) || defined(__i386__) | 34 #elif defined(_M_IX86) || defined(__i386__) |
31 #define V8_HOST_ARCH_IA32 1 | 35 #define V8_HOST_ARCH_IA32 1 |
32 #define V8_HOST_ARCH_32_BIT 1 | 36 #define V8_HOST_ARCH_32_BIT 1 |
33 #define V8_HOST_CAN_READ_UNALIGNED 1 | 37 #define V8_HOST_CAN_READ_UNALIGNED 1 |
34 #elif defined(__AARCH64EL__) | 38 #elif defined(__AARCH64EL__) |
35 #define V8_HOST_ARCH_ARM64 1 | 39 #define V8_HOST_ARCH_ARM64 1 |
36 #define V8_HOST_ARCH_64_BIT 1 | 40 #define V8_HOST_ARCH_64_BIT 1 |
37 #define V8_HOST_CAN_READ_UNALIGNED 1 | 41 #define V8_HOST_CAN_READ_UNALIGNED 1 |
(...skipping 30 matching lines...) Expand all Loading... | |
68 #define V8_TARGET_ARCH_ARM64 1 | 72 #define V8_TARGET_ARCH_ARM64 1 |
69 #elif defined(__ARMEL__) | 73 #elif defined(__ARMEL__) |
70 #define V8_TARGET_ARCH_ARM 1 | 74 #define V8_TARGET_ARCH_ARM 1 |
71 #elif defined(__MIPSEB__) || defined(__MIPSEL__) | 75 #elif defined(__MIPSEB__) || defined(__MIPSEL__) |
72 #define V8_TARGET_ARCH_MIPS 1 | 76 #define V8_TARGET_ARCH_MIPS 1 |
73 #else | 77 #else |
74 #error Target architecture was not detected as supported by v8 | 78 #error Target architecture was not detected as supported by v8 |
75 #endif | 79 #endif |
76 #endif | 80 #endif |
77 | 81 |
82 // Determine architecture pointer size. | |
83 #if V8_TARGET_ARCH_IA32 | |
84 #define V8_TARGET_ARCH_32_BIT 1 | |
85 #elif V8_TARGET_ARCH_X64 | |
86 #if !V8_TARGET_ARCH_32_BIT && !V8_TARGET_ARCH_64_BIT | |
87 #if defined(__x86_64__) && !defined(__LP64__) | |
88 #define V8_TARGET_ARCH_32_BIT 1 | |
89 #else | |
90 #define V8_TARGET_ARCH_64_BIT 1 | |
91 #endif | |
92 #endif | |
93 #elif V8_TARGET_ARCH_ARM | |
94 #define V8_TARGET_ARCH_32_BIT 1 | |
95 #elif V8_TARGET_ARCH_ARM64 | |
96 #define V8_TARGET_ARCH_64_BIT 1 | |
97 #elif V8_TARGET_ARCH_MIPS | |
98 #define V8_TARGET_ARCH_32_BIT 1 | |
99 #elif V8_TARGET_ARCH_X87 | |
100 #define V8_TARGET_ARCH_32_BIT 1 | |
101 #else | |
102 #error Unknown target architecture pointer size | |
103 #endif | |
104 | |
78 // Check for supported combinations of host and target architectures. | 105 // Check for supported combinations of host and target architectures. |
79 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32 | 106 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32 |
80 #error Target architecture ia32 is only supported on ia32 host | 107 #error Target architecture ia32 is only supported on ia32 host |
81 #endif | 108 #endif |
82 #if V8_TARGET_ARCH_X64 && !V8_HOST_ARCH_X64 | 109 #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_64_BIT && \ |
110 !(V8_HOST_ARCH_X64 && V8_HOST_ARCH_64_BIT)) | |
83 #error Target architecture x64 is only supported on x64 host | 111 #error Target architecture x64 is only supported on x64 host |
84 #endif | 112 #endif |
113 #if (V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT && \ | |
114 !(V8_HOST_ARCH_X64 && V8_HOST_ARCH_32_BIT)) | |
115 #error Target architecture x32 is only supported on x64 host with x32 support | |
116 #endif | |
85 #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM)) | 117 #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM)) |
86 #error Target architecture arm is only supported on arm and ia32 host | 118 #error Target architecture arm is only supported on arm and ia32 host |
87 #endif | 119 #endif |
88 #if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64)) | 120 #if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64)) |
89 #error Target architecture arm64 is only supported on arm64 and x64 host | 121 #error Target architecture arm64 is only supported on arm64 and x64 host |
90 #endif | 122 #endif |
91 #if (V8_TARGET_ARCH_MIPS && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_MIPS)) | 123 #if (V8_TARGET_ARCH_MIPS && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_MIPS)) |
92 #error Target architecture mips is only supported on mips and ia32 host | 124 #error Target architecture mips is only supported on mips and ia32 host |
93 #endif | 125 #endif |
94 | 126 |
(...skipping 16 matching lines...) Expand all Loading... | |
111 #define V8_TARGET_LITTLE_ENDIAN 1 | 143 #define V8_TARGET_LITTLE_ENDIAN 1 |
112 #else | 144 #else |
113 #error Unknown target architecture endianness | 145 #error Unknown target architecture endianness |
114 #endif | 146 #endif |
115 | 147 |
116 #if V8_OS_MACOSX || defined(__FreeBSD__) || defined(__OpenBSD__) | 148 #if V8_OS_MACOSX || defined(__FreeBSD__) || defined(__OpenBSD__) |
117 #define USING_BSD_ABI | 149 #define USING_BSD_ABI |
118 #endif | 150 #endif |
119 | 151 |
120 #endif // V8_BASE_BUILD_CONFIG_H_ | 152 #endif // V8_BASE_BUILD_CONFIG_H_ |
OLD | NEW |