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.beat...@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
<sbeat...@ubuntu.com>
http://NxNW.org/~steve/

Attachment: signature.asc
Description: PGP signature

_______________________________________________
ipxe-devel mailing list
ipxe-devel@lists.ipxe.org
https://lists.ipxe.org/mailman/listinfo.cgi/ipxe-devel

Reply via email to