[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:
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=gcc/doc/invoke.texi;h=515d948ce710a2fba98c586ea2efa05d4cf60979;hb=HEAD#l10620
introduced in commit:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=e9abca4f4a48fa8b1fd9778f6a3cd748e099e3bb
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')
WORKAROUND_CFLAGS += $(PIE_FLAGS)
endif
--
Steve Beattie
<sbeattie at ubuntu.com>
http://NxNW.org/~steve/
-------------- 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