1# Firmware is a 32-bit target 2override XEN_TARGET_ARCH = x86_32 3 4# User-supplied CFLAGS are not useful here. 5CFLAGS = 6EXTRA_CFLAGS_XEN_TOOLS = 7 8include $(XEN_ROOT)/tools/Rules.mk 9 10ifneq ($(debug),y) 11CFLAGS += -DNDEBUG 12endif 13 14CFLAGS += -fno-stack-protector 15 16$(call cc-options-add,CFLAGS,CC,$(EMBEDDED_EXTRA_CFLAGS)) 17 18$(call cc-option-add,CFLAGS,CC,-fcf-protection=none) 19 20# Do not add the .note.gnu.property section to any of the firmware objects: it 21# breaks the rombios binary and is not useful for firmware anyway. 22$(call cc-option-add,CFLAGS,CC,-Wa$$(comma)-mx86-used-note=no) 23 24# Extra CFLAGS suitable for an embedded type of environment. 25CFLAGS += -ffreestanding -msoft-float 26 27# Use our own set of stand alone headers to build firmware. 28# 29# Ideally using -ffreestanding should be enough, but that relies on the 30# compiler having the right order for include paths (ie: compiler private 31# headers before system ones) or the libc headers having proper arch-agnostic 32# freestanding support. This is not the case in Alpine at least which searches 33# system headers before compiler ones and has arch-specific libc headers. This 34# has been reported upstream: 35# https://gitlab.alpinelinux.org/alpine/aports/-/issues/12477 36# In the meantime (and for resilience against broken systems) use our own set 37# of headers that provide what's needed for the firmware build. 38CFLAGS += -nostdinc -I$(XEN_ROOT)/tools/firmware/include 39