aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/target-arm.c
blob: 104c319b23ddc1da87696d75fc1815fd0177d98f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "symbol.h"
#include "target.h"
#include "machine.h"


static void init_arm(const struct target *self)
{
	fast16_ctype = &int_ctype;
	ufast16_ctype = &uint_ctype;
	fast32_ctype = &int_ctype;
	ufast32_ctype = &uint_ctype;

	if (arch_os == OS_NONE) {
		int32_ctype = &long_ctype;
		uint32_ctype = &ulong_ctype;
		fast8_ctype = &int_ctype;
		ufast8_ctype = &uint_ctype;
	}
}

static void predefine_arm(const struct target *self)
{
	predefine("__arm__", 1, "1");
	predefine("__VFP_FP__", 1, "1");

	switch (arch_fp_abi) {
	case FP_ABI_HARD:
		predefine("__ARM_PCS_VFP", 1, "1");
		break;
	case FP_ABI_SOFT:
		predefine("__SOFTFP__", 1, "1");
		/* fall-through */
	case FP_ABI_HYBRID:
		predefine("__ARM_PCS", 1, "1");
		break;
	}

	if (arch_big_endian)
		predefine("__ARMEB__", 0, "1");
	else
		predefine("__ARMEL__", 0, "1");
}

const struct target target_arm = {
	.mach = MACH_ARM,
	.bitness = ARCH_LP32,
	.big_endian = 0,
	.unsigned_char = 1,

	.wchar = &uint_ctype,

	.bits_in_longdouble = 64,
	.max_fp_alignment = 8,

	.init = init_arm,
	.predefine = predefine_arm,
};