[meta-virtualization] [PATCH] ipxe: Uprev and fix host compiler and linker flags.

christopher.w.clark at gmail.com christopher.w.clark at gmail.com
Wed Feb 20 16:52:03 PST 2019


From: Christopher Clark <christopher.w.clark at gmail.com>

Adds patch to fix detection of the "no-pie" vs "nopie" flag, which needs
to be performed for both the host and target compilers; cannot assume
that one works for the other.

Use EXTRA_HOST_CFLAGS and EXTRA_HOST_LDFLAGS variables for passing
the host tool build parameters: BUILD_CFLAGS and BUILD_LDFLAGS.

Drop unneeded 'NO_WERROR=1' from the recipe and rewrap line.

Uprev commit to latest git revision.

Signed-off-by: Christopher Clark <christopher.clark6 at baesystems.com>
---
 .../files/ipxe-fix-hostcc-nopie-cflags.patch  | 68 +++++++++++++++++++
 recipes-extended/ipxe/ipxe_git.bb             | 15 +++-
 2 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch

diff --git a/recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch b/recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch
new file mode 100644
index 0000000..da154a6
--- /dev/null
+++ b/recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch
@@ -0,0 +1,68 @@
+Fix detection of host compiler "no-pie"/"nopie" and link flags.
+
+Detection of the "no-pie" vs "nopie" flag needs to be performed for both
+the host and target compilers; cannot assume that one works for the other.
+
+Use EXTRA_HOST_CFLAGS and EXTRA_HOST_LDFLAGS variables for passing
+host tool parameters if required. Removes previous hardcoded "-O2 -g".
+
+Signed-off-by: Christopher Clark <christopher.clark6 at baesystems.com>
+diff --git a/Makefile.housekeeping b/Makefile.housekeeping
+index f833492..5451c39 100644
+--- a/Makefile.housekeeping
++++ b/Makefile.housekeeping
+@@ -133,6 +133,7 @@ eval :
+ WORKAROUND_CFLAGS :=
+ WORKAROUND_ASFLAGS :=
+ WORKAROUND_LDFLAGS :=
++WORKAROUND_HOST_CFLAGS :=
+ 
+ # Make syntax does not allow use of comma or space in certain places.
+ # This ugly workaround is suggested in the manual.
+@@ -445,7 +446,7 @@ endif
+ CFLAGS		+= $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
+ ASFLAGS		+= $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
+ LDFLAGS		+= $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
+-HOST_CFLAGS	+= $(WORKAROUND_CFLAGS) -O2 -g
++HOST_CFLAGS	+= $(WORKAROUND_HOST_CFLAGS) $(EXTRA_HOST_CFLAGS)
+ 
+ # Inhibit -Werror if NO_WERROR is specified on make command line
+ #
+@@ -1375,7 +1376,7 @@ endif # defined(BIN)
+ # The compression utilities
+ #
+ 
+-ZBIN_LDFLAGS := -llzma
++ZBIN_LDFLAGS := -llzma $(EXTRA_HOST_LDFLAGS)
+ 
+ $(ZBIN) : util/zbin.c $(MAKEDEPS)
+ 	$(QM)$(ECHO) "  [HOSTCC] $@"
+diff --git a/arch/i386/Makefile b/arch/i386/Makefile
+index b7c2792..4a637ad 100644
+--- a/arch/i386/Makefile
++++ b/arch/i386/Makefile
+@@ -78,11 +78,20 @@ CFLAGS			+= -Ui386
+ # -nopie.  We therefore test for both.
+ #
+ ifeq ($(CCTYPE),gcc)
+-PIE_TEST = [ -z "`$(CC) -fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1`" ]
+-PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -no-pie')
+-PIE_TEST2 = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
++PIE_TEST1_FLAGS = "-fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1"
++PIE_TEST2_FLAGS = "-fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1"
++
++PIE_TEST1 = [ -z "`$(CC) "$(PIE_TEST1_FLAGS)"`" ]
++PIE_TEST2 = [ -z "`$(CC) "$(PIE_TEST2_FLAGS)"`" ]
++PIE_FLAGS1 := $(shell $(PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie')
+ PIE_FLAGS2 := $(shell $(PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
+-WORKAROUND_CFLAGS += $(PIE_FLAGS) $(PIE_FLAGS2)
++WORKAROUND_CFLAGS += $(PIE_FLAGS1) $(PIE_FLAGS2)
++
++HOST_PIE_TEST1 = [ -z "`$(HOSTCC) "$(PIE_TEST1_FLAGS)"`" ]
++HOST_PIE_TEST2 = [ -z "`$(HOSTCC) "$(PIE_TEST2_FLAGS)"`" ]
++HOST_PIE_FLAGS1 := $(shell $(HOST_PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie')
++HOST_PIE_FLAGS2 := $(shell $(HOST_PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
++WORKAROUND_HOST_CFLAGS += $(HOST_PIE_FLAGS1) $(HOST_PIE_FLAGS2)
+ endif
+ 
+ # i386-specific directories containing source files
diff --git a/recipes-extended/ipxe/ipxe_git.bb b/recipes-extended/ipxe/ipxe_git.bb
index 18c92d2..1de0f21 100644
--- a/recipes-extended/ipxe/ipxe_git.bb
+++ b/recipes-extended/ipxe/ipxe_git.bb
@@ -4,15 +4,24 @@ LICENSE = "GPLv2"
 DEPENDS = "binutils-native perl-native syslinux mtools-native cdrtools-native xz"
 LIC_FILES_CHKSUM = "file://../COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263"
 
-SRCREV = "133f4c47baef6002b2ccb4904a035cda2303c6e5"
+SRCREV = "64b4452bca04af433f1c98ab782c0e93cd5c88c0"
 PV = "gitr${SRCPV}"
 PR = "r0"
 
-SRC_URI = "git://git.ipxe.org/ipxe.git;protocol=https"
+FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
+
+SRC_URI = " \
+    git://git.ipxe.org/ipxe.git;protocol=https \
+    file://ipxe-fix-hostcc-nopie-cflags.patch \
+    "
 
 FILES_${PN} = "/usr/share/firmware/*.rom"
 
-EXTRA_OEMAKE = "NO_WERROR=1 ISOLINUX_BIN="${STAGING_DIR_TARGET}/usr/share/syslinux/isolinux.bin" CROSS_COMPILE="${TARGET_PREFIX}""
+EXTRA_OEMAKE = " \
+    ISOLINUX_BIN="${STAGING_DIR_TARGET}/usr/share/syslinux/isolinux.bin" \
+    CROSS_COMPILE="${TARGET_PREFIX}" \
+    EXTRA_HOST_CFLAGS="${BUILD_CFLAGS}" \
+    EXTRA_HOST_LDFLAGS="${BUILD_LDFLAGS}""
 
 S = "${WORKDIR}/git/src"
 
-- 
2.17.1



More information about the meta-virtualization mailing list