From 3e128c1bcd8f46a37923271b5b722b378eb72d06 Mon Sep 17 00:00:00 2001 From: Christopher Clark Date: Wed, 7 Jul 2021 21:32:44 -0700 Subject: xen, xen-tools: fix build and passing of CFLAGS via Xen vars Ensure that the Xen build system variables EXTRA_CFLAGS_XEN_CORE and EXTRA_CFLAGS_XEN_TOOLS are passed into the compile steps. Update the hypervisor compilation to avoid passing in most compile flags from the build environment via EXTRA_CFLAGS_XEN_CORE -- prefer the compiler defaults and the flags set by the Xen build system, so only the debug prefix flags are provided. Observeration derived from the prior commit e99974aa, so: Reported-by: Diego Sueiro Signed-off-by: Christopher Clark Reviewed-by: Bertrand Marquis Signed-off-by: Bruce Ashfield --- recipes-extended/xen/xen-hypervisor.inc | 3 ++- recipes-extended/xen/xen-tools.inc | 3 ++- recipes-extended/xen/xen.inc | 12 ++++++++++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/recipes-extended/xen/xen-hypervisor.inc b/recipes-extended/xen/xen-hypervisor.inc index 916bd3ce..9b96d91e 100644 --- a/recipes-extended/xen/xen-hypervisor.inc +++ b/recipes-extended/xen/xen-hypervisor.inc @@ -49,7 +49,8 @@ do_configure() { } do_compile() { - oe_runmake xen PYTHON="${PYTHON}" + oe_runmake xen PYTHON="${PYTHON}" \ + EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" } do_install() { diff --git a/recipes-extended/xen/xen-tools.inc b/recipes-extended/xen/xen-tools.inc index 3560e798..2930097c 100644 --- a/recipes-extended/xen/xen-tools.inc +++ b/recipes-extended/xen/xen-tools.inc @@ -727,7 +727,8 @@ do_configure() { do_compile() { cd ${S} - oe_runmake tools PYTHON="${PYTHON}" + oe_runmake tools PYTHON="${PYTHON}" \ + EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}" } do_install() { diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc index 2fbdb3a4..5aa2d5a5 100644 --- a/recipes-extended/xen/xen.inc +++ b/recipes-extended/xen/xen.inc @@ -92,6 +92,16 @@ export LDFLAGS="" # Pass through the Yocto distro compiler flags via the Xen-provided variables. # Special handling: +# - The Yocto distro compiler flags are typically set to be appropriate for +# user-space software rather than for generation of a hypervisor binary, so +# only pass the debug prefix map to the hypervisor build: +EXTRA_CFLAGS_XEN_CORE="${DEBUG_PREFIX_MAP}" + +# - The Xen tools build for x86 systems with HVM-mode enabled includes hvmloader +# which fails to build when "-m64" is included in flags set via the +# EXTRA_CFLAGS_XEN_TOOLS: so clear TUNE_CCARGS on x86 to prevent that. +TUNE_CCARGS_x86-64="" + # - Yocto supplies the _FORTIFY_SOURCE flag via CC/CPP/CXX but then passes the # optimization -O via C*FLAGS which is problematic when the CFLAGS are cleared # within the build because compilation fails with the compiler stating @@ -102,12 +112,10 @@ export LDFLAGS="" # explicitly clears CFLAGS to ensure that, so such options must not be passed # in via the tool variable. hvmloader is required to run HVM-mode guest VMs. CC="${CCACHE}${HOST_PREFIX}gcc ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}" -EXTRA_CFLAGS_XEN_CORE="${HOST_CC_ARCH} ${CFLAGS}" EXTRA_CFLAGS_XEN_TOOLS="${HOST_CC_ARCH} ${CFLAGS}" # 32-bit ARM needs the TUNE_CCARGS component of HOST_CC_ARCH to be passed # in CC to ensure that configure can compile binaries for the right arch. CC_arm="${CCACHE}${HOST_PREFIX}gcc ${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS} ${CC_REPRODUCIBLE_OPTIONS}" -EXTRA_CFLAGS_XEN_CORE_arm="${SECURITY_CFLAGS} ${CFLAGS}" EXTRA_CFLAGS_XEN_TOOLS_arm="${SECURITY_CFLAGS} ${CFLAGS}" # There are no Xen-provided variables for C++, so append to the tool variables: -- cgit v1.2.3-54-g00ecf