Files
Volodymyr Babchuk 981d5550fd common: remove -fno-stack-protector from EMBEDDED_EXTRA_CFLAGS
This patch is preparation for making stack protector
configurable. First step is to remove -fno-stack-protector flag from
EMBEDDED_EXTRA_CFLAGS so separate components (Hypervisor in this case)
can enable/disable this feature by themselves.

Signed-off-by: Volodymyr Babchuk <volodymyr_babchuk@epam.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
2025-03-04 12:53:15 +00:00

39 lines
1.4 KiB
Makefile

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