1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
4
5
init_arm64(const struct target * self)6 static void init_arm64(const struct target *self)
7 {
8 if (arch_cmodel == CMODEL_UNKNOWN)
9 arch_cmodel = CMODEL_SMALL;
10 }
11
predefine_arm64(const struct target * self)12 static void predefine_arm64(const struct target *self)
13 {
14 static const char *cmodels[CMODEL_LAST] = {
15 [CMODEL_LARGE] = "LARGE",
16 [CMODEL_SMALL] = "SMALL",
17 [CMODEL_TINY] = "TINY",
18 };
19 const char *cmodel = cmodels[arch_cmodel];
20
21 predefine("__aarch64__", 1, "1");
22
23 if (arch_big_endian)
24 predefine("__AARCH64EB__", 0, "1");
25 else
26 predefine("__AARCH64EL__", 0, "1");
27
28 if (cmodel)
29 predefine_strong("__AARCH64_CMODEL_%s__", cmodel);
30 }
31
32 const struct target target_arm64 = {
33 .mach = MACH_ARM64,
34 .bitness = ARCH_LP64,
35
36 .big_endian = 0,
37 .unsigned_char = 1,
38 .has_int128 = 1,
39
40 .wchar = &uint_ctype,
41
42 .init = init_arm64,
43 .predefine = predefine_arm64,
44 };
45