[ipxe-devel] [PATCH] [build] Use correct PIE disabling argument with gcc

Steve Beattie steve.beattie at canonical.com
Fri Apr 29 19:59:02 UTC 2016

Hardened versions of gcc default to building position-independent
code, which breaks the i386 build. Upstream GCC has standardized on
using -no-pie to turn off PIE:


introduced in commit:


However, the test in src/arch/i386/Makefile looks for '-nopie' which
is not a valid upstream GCC argument. This patch converts the test
to look for '-no-pie'.

Signed-off-by: Steve Beattie <steve.beattie at canonical.com>

diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile
index fe3adc9..59ad25b 100644
--- a/src/arch/i386/Makefile
+++ b/src/arch/i386/Makefile
@@ -75,8 +75,8 @@ CFLAGS			+= -Ui386
 # output on stderr instead of checking the exit status.
 ifeq ($(CCTYPE),gcc)
-PIE_TEST = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
-PIE_FLAGS := $(shell $(PIE_TEST) && $(ECHO) '-fno-PIE -nopie')
+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')

Steve Beattie
<sbeattie at ubuntu.com>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.ipxe.org/pipermail/ipxe-devel/attachments/20160429/a64fa444/attachment.sig>

More information about the ipxe-devel mailing list