aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/Rules.mk
blob: 176d6aebf415b7adf46542940ffe286d120b82f8 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
########################################
# x86-specific definitions

HAS_ACPI := y
HAS_VGA  := y

#
# If you change any of these configuration options then you must
# 'make clean' before rebuilding.
#
pae ?= n
supervisor_mode_kernel ?= n

CFLAGS  += -nostdinc -fno-builtin -fno-common -fno-strict-aliasing
CFLAGS  += -iwithprefix include -Werror -Wno-pointer-arith -pipe
CFLAGS  += -I$(BASEDIR)/include 
CFLAGS  += -I$(BASEDIR)/include/asm-x86/mach-generic
CFLAGS  += -I$(BASEDIR)/include/asm-x86/mach-default

# Prevent floating-point variables from creeping into Xen.
CFLAGS  += -msoft-float

# Disable PIE/SSP if GCC supports them. They can break us.
CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)

ifeq ($(TARGET_SUBARCH)$(pae),x86_32y)
CFLAGS  += -DCONFIG_X86_PAE=1
endif

ifeq ($(supervisor_mode_kernel),y)
CFLAGS  += -DCONFIG_X86_SUPERVISOR_MODE_KERNEL=1
endif

ifeq ($(XEN_TARGET_ARCH),x86_32)
LDFLAGS += -m elf_i386
x86_32 := y
x86_64 := n
endif

ifeq ($(TARGET_SUBARCH),x86_64)
CFLAGS  += -mno-red-zone -fpic -fno-reorder-blocks
CFLAGS  += -fno-asynchronous-unwind-tables
# -fvisibility=hidden reduces -fpic cost, if it's available
CFLAGS  += $(shell $(CC) -v --help 2>&1 | grep " -fvisibility=" | \
             grep -q hidden && echo "-DGCC_HAS_VISIBILITY_ATTRIBUTE")
LDFLAGS += -m elf_x86_64
x86_32 := n
x86_64 := y
endif

HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/svm/*.h)
HDRS += $(wildcard $(BASEDIR)/include/asm-x86/hvm/vmx/*.h)

# Test for at least GCC v3.2.x.
gcc-ver = $(shell $(CC) -dumpversion | sed -e 's/^\(.\)\.\(.\)\.\(.\)/\$(1)/')
ifeq ($(call gcc-ver,1),1)
$(error gcc-1.x.x unsupported - upgrade to at least gcc-3.2.x)
endif
ifeq ($(call gcc-ver,1),2)
$(error gcc-2.x.x unsupported - upgrade to at least gcc-3.2.x)
endif
ifeq ($(call gcc-ver,1),3)
ifeq ($(call gcc-ver,2),0)
$(error gcc-3.0.x unsupported - upgrade to at least gcc-3.2.x)
endif
ifeq ($(call gcc-ver,2),1)
$(error gcc-3.1.x unsupported - upgrade to at least gcc-3.2.x)
endif
endif