[ipxe-devel] [PATCH v2] arch: i386: Check for -no-pie gcc option as well.

Markos Chandras mchandras at suse.de
Mon Jun 5 11:59:30 UTC 2017


openSUSE Tumbleweed switched on PIE by default since gcc-7.1.1. However,
-nopie option is not a recognized upstream option so the existing check
fails with

gcc: error: unrecognized command line option '-nopie'; did you mean
'-no-pie'?

as such, we also need to check for '-no-pie' option as well.

Signed-off-by: Markos Chandras <mchandras at suse.de>
---
 src/arch/i386/Makefile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile
index fe3adc9c..4cc70194 100644
--- a/src/arch/i386/Makefile
+++ b/src/arch/i386/Makefile
@@ -78,6 +78,12 @@ 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')
 WORKAROUND_CFLAGS += $(PIE_FLAGS)
+# openSUSE Tumbleweed switched on PIE by default since gcc-7.1.1. However -nopie
+# is not a recognized option so we need to check for -no-pie instead. -no-pie
+# seems to be the recognized option upstream as well.
+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
 
 # i386-specific directories containing source files
-- 
2.12.2




More information about the ipxe-devel mailing list