summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch68
-rw-r--r--recipes-extended/ipxe/ipxe_git.bb15
2 files changed, 80 insertions, 3 deletions
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 00000000..da154a6f
--- /dev/null
+++ b/recipes-extended/ipxe/files/ipxe-fix-hostcc-nopie-cflags.patch
@@ -0,0 +1,68 @@
1Fix detection of host compiler "no-pie"/"nopie" and link flags.
2
3Detection of the "no-pie" vs "nopie" flag needs to be performed for both
4the host and target compilers; cannot assume that one works for the other.
5
6Use EXTRA_HOST_CFLAGS and EXTRA_HOST_LDFLAGS variables for passing
7host tool parameters if required. Removes previous hardcoded "-O2 -g".
8
9Signed-off-by: Christopher Clark <christopher.clark6@baesystems.com>
10diff --git a/Makefile.housekeeping b/Makefile.housekeeping
11index f833492..5451c39 100644
12--- a/Makefile.housekeeping
13+++ b/Makefile.housekeeping
14@@ -133,6 +133,7 @@ eval :
15 WORKAROUND_CFLAGS :=
16 WORKAROUND_ASFLAGS :=
17 WORKAROUND_LDFLAGS :=
18+WORKAROUND_HOST_CFLAGS :=
19
20 # Make syntax does not allow use of comma or space in certain places.
21 # This ugly workaround is suggested in the manual.
22@@ -445,7 +446,7 @@ endif
23 CFLAGS += $(WORKAROUND_CFLAGS) $(EXTRA_CFLAGS)
24 ASFLAGS += $(WORKAROUND_ASFLAGS) $(EXTRA_ASFLAGS)
25 LDFLAGS += $(WORKAROUND_LDFLAGS) $(EXTRA_LDFLAGS)
26-HOST_CFLAGS += $(WORKAROUND_CFLAGS) -O2 -g
27+HOST_CFLAGS += $(WORKAROUND_HOST_CFLAGS) $(EXTRA_HOST_CFLAGS)
28
29 # Inhibit -Werror if NO_WERROR is specified on make command line
30 #
31@@ -1375,7 +1376,7 @@ endif # defined(BIN)
32 # The compression utilities
33 #
34
35-ZBIN_LDFLAGS := -llzma
36+ZBIN_LDFLAGS := -llzma $(EXTRA_HOST_LDFLAGS)
37
38 $(ZBIN) : util/zbin.c $(MAKEDEPS)
39 $(QM)$(ECHO) " [HOSTCC] $@"
40diff --git a/arch/i386/Makefile b/arch/i386/Makefile
41index b7c2792..4a637ad 100644
42--- a/arch/i386/Makefile
43+++ b/arch/i386/Makefile
44@@ -78,11 +78,20 @@ CFLAGS += -Ui386
45 # -nopie. We therefore test for both.
46 #
47 ifeq ($(CCTYPE),gcc)
48-PIE_TEST = [ -z "`$(CC) -fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1`" ]
49-PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -no-pie')
50-PIE_TEST2 = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
51+PIE_TEST1_FLAGS = "-fno-PIE -no-pie -x c -c /dev/null -o /dev/null 2>&1"
52+PIE_TEST2_FLAGS = "-fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1"
53+
54+PIE_TEST1 = [ -z "`$(CC) "$(PIE_TEST1_FLAGS)"`" ]
55+PIE_TEST2 = [ -z "`$(CC) "$(PIE_TEST2_FLAGS)"`" ]
56+PIE_FLAGS1 := $(shell $(PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie')
57 PIE_FLAGS2 := $(shell $(PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
58-WORKAROUND_CFLAGS += $(PIE_FLAGS) $(PIE_FLAGS2)
59+WORKAROUND_CFLAGS += $(PIE_FLAGS1) $(PIE_FLAGS2)
60+
61+HOST_PIE_TEST1 = [ -z "`$(HOSTCC) "$(PIE_TEST1_FLAGS)"`" ]
62+HOST_PIE_TEST2 = [ -z "`$(HOSTCC) "$(PIE_TEST2_FLAGS)"`" ]
63+HOST_PIE_FLAGS1 := $(shell $(HOST_PIE_TEST1) && $(ECHO) '-fno-PIE -no-pie')
64+HOST_PIE_FLAGS2 := $(shell $(HOST_PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
65+WORKAROUND_HOST_CFLAGS += $(HOST_PIE_FLAGS1) $(HOST_PIE_FLAGS2)
66 endif
67
68 # i386-specific directories containing source files
diff --git a/recipes-extended/ipxe/ipxe_git.bb b/recipes-extended/ipxe/ipxe_git.bb
index 18c92d2b..1de0f21e 100644
--- a/recipes-extended/ipxe/ipxe_git.bb
+++ b/recipes-extended/ipxe/ipxe_git.bb
@@ -4,15 +4,24 @@ LICENSE = "GPLv2"
4DEPENDS = "binutils-native perl-native syslinux mtools-native cdrtools-native xz" 4DEPENDS = "binutils-native perl-native syslinux mtools-native cdrtools-native xz"
5LIC_FILES_CHKSUM = "file://../COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263" 5LIC_FILES_CHKSUM = "file://../COPYING.GPLv2;md5=b234ee4d69f5fce4486a80fdaf4a4263"
6 6
7SRCREV = "133f4c47baef6002b2ccb4904a035cda2303c6e5" 7SRCREV = "64b4452bca04af433f1c98ab782c0e93cd5c88c0"
8PV = "gitr${SRCPV}" 8PV = "gitr${SRCPV}"
9PR = "r0" 9PR = "r0"
10 10
11SRC_URI = "git://git.ipxe.org/ipxe.git;protocol=https" 11FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
12
13SRC_URI = " \
14 git://git.ipxe.org/ipxe.git;protocol=https \
15 file://ipxe-fix-hostcc-nopie-cflags.patch \
16 "
12 17
13FILES_${PN} = "/usr/share/firmware/*.rom" 18FILES_${PN} = "/usr/share/firmware/*.rom"
14 19
15EXTRA_OEMAKE = "NO_WERROR=1 ISOLINUX_BIN="${STAGING_DIR_TARGET}/usr/share/syslinux/isolinux.bin" CROSS_COMPILE="${TARGET_PREFIX}"" 20EXTRA_OEMAKE = " \
21 ISOLINUX_BIN="${STAGING_DIR_TARGET}/usr/share/syslinux/isolinux.bin" \
22 CROSS_COMPILE="${TARGET_PREFIX}" \
23 EXTRA_HOST_CFLAGS="${BUILD_CFLAGS}" \
24 EXTRA_HOST_LDFLAGS="${BUILD_LDFLAGS}""
16 25
17S = "${WORKDIR}/git/src" 26S = "${WORKDIR}/git/src"
18 27