summaryrefslogtreecommitdiffstats
path: root/recipes-extended/xen/xen.inc
diff options
context:
space:
mode:
authorChristopher Clark <christopher.w.clark@gmail.com>2020-02-25 16:15:48 -0800
committerBruce Ashfield <bruce.ashfield@gmail.com>2020-02-27 16:59:22 -0500
commit64eb6f5595ebaff529db60b2fff5e05ec71be2b1 (patch)
treee5423d388680bfa0a6579d9f2833917d5dc404dc /recipes-extended/xen/xen.inc
parent7c4e062505ed92739bca899bf8a7263ada620ada (diff)
downloadmeta-virtualization-64eb6f5595ebaff529db60b2fff5e05ec71be2b1.tar.gz
xen: pass compiler flags via Xen-provided variables
Fix the method of passing compiler flags into the Xen build, which is needed to fix compilation of hvmloader, a 32-bit firmware binary that is required for Xen to be able to run HVM-mode guest VMs. It must not be compiled with SSE compiler options enabled, so the Xen build clears CFLAGS, which is a problem with _FORTIFY_SOURCE present in CC because it must be paired with a compiler optimization flag that was in CFLAGS. This change fixes the compilation failure that stated "_FORTIFY_SOURCE requires compiling with optimization (-O)". 32-bit ARM needs the TUNE_CCARGS to be retained as passed via CC to ensure that configure is able to generate binaries for the correct ABI, so is handled as a separate case. Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com> Reviewed-by: Jason Andryuk <jandryuk@gmail.com> Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Diffstat (limited to 'recipes-extended/xen/xen.inc')
-rw-r--r--recipes-extended/xen/xen.inc35
1 files changed, 25 insertions, 10 deletions
diff --git a/recipes-extended/xen/xen.inc b/recipes-extended/xen/xen.inc
index 36ab78e2..4ac954ec 100644
--- a/recipes-extended/xen/xen.inc
+++ b/recipes-extended/xen/xen.inc
@@ -867,15 +867,27 @@ export CROSS_COMPILE="${TARGET_PREFIX}"
867# overide LDFLAGS to allow xen to build without: "x86_64-oe-linux-ld: unrecognized option '-Wl,-O1'" 867# overide LDFLAGS to allow xen to build without: "x86_64-oe-linux-ld: unrecognized option '-Wl,-O1'"
868export LDFLAGS="" 868export LDFLAGS=""
869 869
870# Yocto injects -mfpmath=sse for some machine types into the CFLAGS which 870# Pass through the Yocto distro compiler flags via the Xen-provided variables.
871# conflicts with -mno-sse so instead we strip -mfpmath=sse instead of 871# Special handling:
872# patching the build to be ok with this 872# - Yocto supplies the _FORTIFY_SOURCE flag via CC/CPP/CXX but then passes the
873TUNE_CCARGS := "${@oe.utils.str_filter_out('-mfpmath=sse', '${TUNE_CCARGS}', d)}" 873# optimization -O via C*FLAGS which is problematic when the CFLAGS are cleared
874TUNE_CCARGS := "${@oe.utils.str_filter_out('-msse4.2', '${TUNE_CCARGS}', d)}" 874# within the build because compilation fails with the compiler stating
875 875# "_FORTIFY_SOURCE requires compiling with optimization (-O)".
876# Supply the full set of compiler flags via the tool variables 876# - Move HOST_CC_ARCH into the Xen-provided CFLAGS variables and keep
877# Yocto supplys _FORTIFY_SOURCE via CC/CPP/CXX but optimization -O via C*FLAGS 877# TOOLCHAIN_OPTIONS set via CC: this enables hvmloader to be built correctly.
878CC_append = " ${CFLAGS}" 878# It must not be compiled with SSE compiler options enabled and the Xen build
879# explicitly clears CFLAGS to ensure that, so such options must not be passed
880# in via the tool variable. hvmloader is required to run HVM-mode guest VMs.
881CC="${CCACHE}${HOST_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"
882EXTRA_CFLAGS_XEN_CORE="${HOST_CC_ARCH} ${CFLAGS}"
883EXTRA_CFLAGS_XEN_TOOLS="${HOST_CC_ARCH} ${CFLAGS}"
884# 32-bit ARM needs the TUNE_CCARGS component of HOST_CC_ARCH to be passed
885# in CC to ensure that configure can compile binaries for the right arch.
886CC_arm="${CCACHE}${HOST_PREFIX}gcc ${TUNE_CCARGS} ${TOOLCHAIN_OPTIONS}"
887EXTRA_CFLAGS_XEN_CORE_arm="${SECURITY_CFLAGS} ${CFLAGS}"
888EXTRA_CFLAGS_XEN_TOOLS_arm="${SECURITY_CFLAGS} ${CFLAGS}"
889
890# There are no Xen-provided variables for C++, so append to the tool variables:
879CPP_append = " ${CPPFLAGS}" 891CPP_append = " ${CPPFLAGS}"
880CXX_append = " ${CXXFLAGS}" 892CXX_append = " ${CXXFLAGS}"
881 893
@@ -996,8 +1008,11 @@ do_configure() {
996 bbfatal "Unable to copy defconfig to .config" 1008 bbfatal "Unable to copy defconfig to .config"
997 fi 1009 fi
998 1010
1011 unset CFLAGS
1012
999 # do configure 1013 # do configure
1000 oe_runconf 1014 oe_runconf EXTRA_CFLAGS_XEN_CORE="${EXTRA_CFLAGS_XEN_CORE}" \
1015 EXTRA_CFLAGS_XEN_TOOLS="${EXTRA_CFLAGS_XEN_TOOLS}"
1001 if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then 1016 if [ ! -e ${STAGING_INCDIR}/bits/long-double-32.h ]; then
1002 cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h 1017 cp ${STAGING_INCDIR}/bits/long-double-64.h ${STAGING_INCDIR}/bits/long-double-32.h
1003 fi 1018 fi