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 3 // found in the LICENSE file. 4 5 #ifndef V8_BASE_BUILD_CONFIG_H_ 6 #define V8_BASE_BUILD_CONFIG_H_ 7 8 #include "include/v8config.h" 9 10 // Processor architecture detection. For more info on what's defined, see: 11 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx 12 // http://www.agner.org/optimize/calling_conventions.pdf 13 // or with gcc, run: "echo | gcc -E -dM -" 14 #if defined(_M_X64) || defined(__x86_64__) 15 #if defined(__native_client__) 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 18 // compiled for the host architecture in question. 19 // 20 // Since Native Client is ILP-32 on all architectures we use 21 // V8_HOST_ARCH_IA32 on both 32- and 64-bit x86. 22 #define V8_HOST_ARCH_IA32 1 23 #define V8_HOST_ARCH_32_BIT 1 24 #define V8_HOST_CAN_READ_UNALIGNED 1 25 #else 26 #define V8_HOST_ARCH_X64 1 27 #define V8_HOST_ARCH_64_BIT 1 28 #define V8_HOST_CAN_READ_UNALIGNED 1 29 #endif // __native_client__ 30 #elif defined(_M_IX86) || defined(__i386__) 31 #define V8_HOST_ARCH_IA32 1 32 #define V8_HOST_ARCH_32_BIT 1 33 #define V8_HOST_CAN_READ_UNALIGNED 1 34 #elif defined(__AARCH64EL__) 35 #define V8_HOST_ARCH_ARM64 1 36 #define V8_HOST_ARCH_64_BIT 1 37 #define V8_HOST_CAN_READ_UNALIGNED 1 38 #elif defined(__ARMEL__) 39 #define V8_HOST_ARCH_ARM 1 40 #define V8_HOST_ARCH_32_BIT 1 41 #elif defined(__MIPSEB__) || defined(__MIPSEL__) 42 #define V8_HOST_ARCH_MIPS 1 43 #define V8_HOST_ARCH_32_BIT 1 44 #else 45 #error "Host architecture was not detected as supported by v8" 46 #endif 47 48 #if defined(__ARM_ARCH_7A__) || \ 49 defined(__ARM_ARCH_7R__) || \ 50 defined(__ARM_ARCH_7__) 51 # define CAN_USE_ARMV7_INSTRUCTIONS 1 52 # ifndef CAN_USE_VFP3_INSTRUCTIONS 53 # define CAN_USE_VFP3_INSTRUCTIONS 54 # endif 55 #endif 56 57 58 // Target architecture detection. This may be set externally. If not, detect 59 // in the same way as the host architecture, that is, target the native 60 // environment as presented by the compiler. 61 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && !V8_TARGET_ARCH_X87 && \ 62 !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS 63 #if defined(_M_X64) || defined(__x86_64__) 64 #define V8_TARGET_ARCH_X64 1 65 #elif defined(_M_IX86) || defined(__i386__) 66 #define V8_TARGET_ARCH_IA32 1 67 #elif defined(__AARCH64EL__) 68 #define V8_TARGET_ARCH_ARM64 1 69 #elif defined(__ARMEL__) 70 #define V8_TARGET_ARCH_ARM 1 71 #elif defined(__MIPSEB__) || defined(__MIPSEL__) 72 #define V8_TARGET_ARCH_MIPS 1 73 #else 74 #error Target architecture was not detected as supported by v8 75 #endif 76 #endif 77 78 // Check for supported combinations of host and target architectures. 79 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32 80 #error Target architecture ia32 is only supported on ia32 host 81 #endif 82 #if V8_TARGET_ARCH_X64 && !V8_HOST_ARCH_X64 83 #error Target architecture x64 is only supported on x64 host 84 #endif 85 #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 87 #endif 88 #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 90 #endif 91 #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 93 #endif 94 95 // Determine architecture endianness. 96 #if V8_TARGET_ARCH_IA32 97 #define V8_TARGET_LITTLE_ENDIAN 1 98 #elif V8_TARGET_ARCH_X64 99 #define V8_TARGET_LITTLE_ENDIAN 1 100 #elif V8_TARGET_ARCH_ARM 101 #define V8_TARGET_LITTLE_ENDIAN 1 102 #elif V8_TARGET_ARCH_ARM64 103 #define V8_TARGET_LITTLE_ENDIAN 1 104 #elif V8_TARGET_ARCH_MIPS 105 #if defined(__MIPSEB__) 106 #define V8_TARGET_BIG_ENDIAN 1 107 #else 108 #define V8_TARGET_LITTLE_ENDIAN 1 109 #endif 110 #elif V8_TARGET_ARCH_X87 111 #define V8_TARGET_LITTLE_ENDIAN 1 112 #else 113 #error Unknown target architecture endianness 114 #endif 115 116 #if V8_OS_MACOSX || defined(__FreeBSD__) || defined(__OpenBSD__) 117 #define USING_BSD_ABI 118 #endif 119 120 #endif // V8_BASE_BUILD_CONFIG_H_ 121