7 /* Define architecture */
8 #if defined(__i386__) || defined _M_IX86
9 # define TRIPLET_ARCH "i386"
10 #elif defined(__x86_64__) || defined _M_AMD64
11 # define TRIPLET_ARCH "x86_64"
12 #elif defined(__arm__)
13 # define TRIPLET_ARCH "arm"
14 #elif defined(__aarch64__)
15 # define TRIPLET_ARCH "aarch64"
16 #elif defined(__riscv) && defined(__LP64__)
17 # define TRIPLET_ARCH "riscv64"
19 # define TRIPLET_ARCH "unknown"
23 #if defined (__linux__)
24 # define TRIPLET_OS "linux"
25 #elif defined (__FreeBSD__) || defined (__FreeBSD_kernel__)
26 # define TRIPLET_OS "kfreebsd"
28 # define TRIPLET_OS "win32"
29 #elif !defined (__GNU__)
30 # define TRIPLET_OS "unknown"
33 /* Define calling convention and ABI */
34 #if defined (__ARM_EABI__)
35 # if defined (__ARM_PCS_VFP)
36 # define TRIPLET_ABI "gnueabihf"
38 # define TRIPLET_ABI "gnueabi"
41 # define TRIPLET_ABI "gnu"
45 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS
47 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_ABI
49 # define TRIPLET TRIPLET_ARCH "-" TRIPLET_OS "-" TRIPLET_ABI
56 int main(int argc
, char *argv
[])
59 _setmode(_fileno(stdout
), _O_BINARY
); /* don't translate \n to \r\n */
61 switch(argc
== 2 ? argv
[1][0] : 0) {
64 volatile unsigned foo
= 0x01234567;
65 puts(*(unsigned char*)&foo
== 0x67 ? "no" : "yes");
70 printf("%d\n", __GNUC_MINOR__
);
73 printf("%d\n", __GNUC__
);
75 #elif defined __TINYC__
80 printf("%d\n", __TINYC__
);