diff options
Diffstat (limited to 'nacl/okcompilers/abiname.c')
-rw-r--r-- | nacl/okcompilers/abiname.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/nacl/okcompilers/abiname.c b/nacl/okcompilers/abiname.c new file mode 100644 index 00000000..38373201 --- /dev/null +++ b/nacl/okcompilers/abiname.c | |||
@@ -0,0 +1,45 @@ | |||
1 | #include <stdio.h> | ||
2 | |||
3 | const char *abi(void) | ||
4 | { | ||
5 | #if defined(__amd64__) || defined(__x86_64__) || defined(__AMD64__) || defined(_M_X64) || defined(__amd64) | ||
6 | return "amd64"; | ||
7 | #elif defined(__i386__) || defined(__x86__) || defined(__X86__) || defined(_M_IX86) || defined(__i386) | ||
8 | return "x86"; | ||
9 | #elif defined(__ia64__) || defined(__IA64__) || defined(__M_IA64) | ||
10 | return "ia64"; | ||
11 | #elif defined(__SPU__) | ||
12 | return "cellspu"; | ||
13 | #elif defined(__powerpc64__) || defined(__ppc64__) || defined(__PPC64__) || defined(_ARCH_PPC64) | ||
14 | return "ppc64"; | ||
15 | #elif defined(__powerpc__) || defined(__ppc__) || defined(__PPC__) || defined(_ARCH_PPC) | ||
16 | return "ppc32"; | ||
17 | #elif defined(__sparcv9__) || defined(__sparcv9) | ||
18 | return "sparcv9"; | ||
19 | #elif defined(__sparc_v8__) | ||
20 | return "sparcv8"; | ||
21 | #elif defined(__sparc__) || defined(__sparc) | ||
22 | if (sizeof(long) == 4) return "sparcv8"; | ||
23 | return "sparcv9"; | ||
24 | #elif defined(__ARM_EABI__) | ||
25 | return "armeabi"; | ||
26 | #elif defined(__arm__) | ||
27 | return "arm"; | ||
28 | #elif defined(__mips__) || defined(__mips) || defined(__MIPS__) | ||
29 | # if defined(_ABIO32) | ||
30 | return "mipso32"; | ||
31 | # elif defined(_ABIN32) | ||
32 | return "mips32"; | ||
33 | # else | ||
34 | return "mips64"; | ||
35 | # endif | ||
36 | #else | ||
37 | return "default"; | ||
38 | #endif | ||
39 | } | ||
40 | |||
41 | int main(int argc,char **argv) | ||
42 | { | ||
43 | printf("%s %s\n",argv[1],abi()); | ||
44 | return 0; | ||
45 | } | ||