1 #include "symbol.h"
2 #include "target.h"
3 #include "machine.h"
4
5
6 static int sparc_version;
7
predefine_sparc(const struct target * self)8 static void predefine_sparc(const struct target *self)
9 {
10 predefine("__sparc__", 1, "1");
11 predefine("__sparc", 1, "1");
12 predefine_nostd("sparc");
13
14 predefine_weak("__sparc_v%d__", sparc_version);
15 predefine_weak("__sparcv%d__", sparc_version);
16 predefine_weak("__sparcv%d", sparc_version);
17 }
18
19
init_sparc32(const struct target * target)20 static void init_sparc32(const struct target *target)
21 {
22 fast16_ctype = &int_ctype;
23 ufast16_ctype = &uint_ctype;
24 fast32_ctype = &int_ctype;
25 ufast32_ctype = &uint_ctype;
26
27 if (!sparc_version)
28 sparc_version = 8;
29
30 if (arch_os == OS_SUNOS) {
31 wint_ctype = &long_ctype;
32 wchar_ctype = &long_ctype;
33
34 bits_in_longdouble = 128;
35 max_fp_alignment = 16;
36
37 funsigned_char = 0;
38 }
39 }
40
predefine_sparc32(const struct target * self)41 static void predefine_sparc32(const struct target *self)
42 {
43 predefine_sparc(self);
44 }
45
46 const struct target target_sparc32 = {
47 .mach = MACH_SPARC32,
48 .bitness = ARCH_LP32,
49 .big_endian = 1,
50 .unsigned_char = 0,
51
52 .bits_in_longdouble = 64,
53 .max_fp_alignment = 8,
54
55 .init = init_sparc32,
56 .target_64bit = &target_sparc64,
57
58 .predefine = predefine_sparc32,
59 };
60
61
init_sparc64(const struct target * target)62 static void init_sparc64(const struct target *target)
63 {
64 if (!sparc_version)
65 sparc_version = 9;
66 }
67
predefine_sparc64(const struct target * self)68 static void predefine_sparc64(const struct target *self)
69 {
70 predefine("__sparc64__", 1, "1");
71 predefine("__arch64__", 1, "1");
72
73 predefine_sparc(self);
74 }
75
76 const struct target target_sparc64 = {
77 .mach = MACH_SPARC64,
78 .bitness = ARCH_LP64,
79 .big_endian = 1,
80 .unsigned_char = 0,
81 .has_int128 = 1,
82
83 .target_32bit = &target_sparc32,
84
85 .init = init_sparc64,
86 .predefine = predefine_sparc64,
87 };
88