1######################################## 2# x86-specific definitions 3 4export XEN_IMG_OFFSET := 0x200000 5 6CFLAGS += -I$(BASEDIR)/include 7CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-generic 8CFLAGS += -I$(BASEDIR)/include/asm-x86/mach-default 9CFLAGS += -DXEN_IMG_OFFSET=$(XEN_IMG_OFFSET) 10 11# Prevent floating-point variables from creeping into Xen. 12CFLAGS += -msoft-float 13 14$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) 15$(call cc-option-add,CFLAGS,CC,-Wnested-externs) 16$(call as-option-add,CFLAGS,CC,"vmcall",-DHAVE_AS_VMX) 17$(call as-option-add,CFLAGS,CC,"crc32 %eax$$(comma)%eax",-DHAVE_AS_SSE4_2) 18$(call as-option-add,CFLAGS,CC,"invept (%rax)$$(comma)%rax",-DHAVE_AS_EPT) 19$(call as-option-add,CFLAGS,CC,"rdrand %eax",-DHAVE_AS_RDRAND) 20$(call as-option-add,CFLAGS,CC,"rdfsbase %rax",-DHAVE_AS_FSGSBASE) 21$(call as-option-add,CFLAGS,CC,"xsaveopt (%rax)",-DHAVE_AS_XSAVEOPT) 22$(call as-option-add,CFLAGS,CC,"rdseed %eax",-DHAVE_AS_RDSEED) 23$(call as-option-add,CFLAGS,CC,"clwb (%rax)",-DHAVE_AS_CLWB) 24$(call as-option-add,CFLAGS,CC,".equ \"x\"$$(comma)1",-DHAVE_AS_QUOTED_SYM) 25$(call as-option-add,CFLAGS,CC,"invpcid (%rax)$$(comma)%rax",-DHAVE_AS_INVPCID) 26$(call as-option-add,CFLAGS,CC,"movdiri %rax$$(comma)(%rax)",-DHAVE_AS_MOVDIR) 27$(call as-option-add,CFLAGS,CC,"enqcmd (%rax)$$(comma)%rax",-DHAVE_AS_ENQCMD) 28 29# GAS's idea of true is -1. Clang's idea is 1 30$(call as-option-add,CFLAGS,CC,\ 31 ".if ((1 > 0) < 0); .error \"\";.endif",,-DHAVE_AS_NEGATIVE_TRUE) 32 33# Check to see whether the assmbler supports the .nop directive. 34$(call as-option-add,CFLAGS,CC,\ 35 ".L1: .L2: .nops (.L2 - .L1)$$(comma)9",-DHAVE_AS_NOPS_DIRECTIVE) 36 37CFLAGS += -mno-red-zone -fpic 38 39# Xen doesn't use SSE interally. If the compiler supports it, also skip the 40# SSE setup for variadic function calls. 41CFLAGS += -mno-sse $(call cc-option,$(CC),-mskip-rax-setup) 42 43# Compile with thunk-extern, indirect-branch-register if avaiable. 44CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch=thunk-extern 45CFLAGS-$(CONFIG_INDIRECT_THUNK) += -mindirect-branch-register 46CFLAGS-$(CONFIG_INDIRECT_THUNK) += -fno-jump-tables 47 48# If supported by the compiler, reduce stack alignment to 8 bytes. But allow 49# this to be overridden elsewhere. 50$(call cc-option-add,CFLAGS-stack-boundary,CC,-mpreferred-stack-boundary=3) 51export CFLAGS-stack-boundary 52 53ifeq ($(CONFIG_UBSAN),y) 54# Don't enable alignment sanitisation. x86 has efficient unaligned accesses, 55# and various things (ACPI tables, hypercall pages, stubs, etc) are wont-fix. 56# It also causes an as-yet-unidentified crash on native boot before the 57# console starts. 58$(call cc-option-add,CFLAGS_UBSAN,CC,-fno-sanitize=alignment) 59endif 60 61# Set up the assembler include path properly for older toolchains. 62CFLAGS += -Wa,-I$(BASEDIR)/include 63