summaryrefslogtreecommitdiffstats
path: root/src/arch
diff options
context:
space:
mode:
authorMichael Brown2017-06-14 13:33:16 +0200
committerMichael Brown2017-06-14 13:33:16 +0200
commit7c395b0e21806b946fe944a27fc273407f357ea1 (patch)
treee96d8022cf9c77f249a88d0a3152d0e988ebf276 /src/arch
parent[intel] Add INTEL_NO_PHY_RST for I219-V (diff)
downloadipxe-7c395b0e21806b946fe944a27fc273407f357ea1.tar.gz
ipxe-7c395b0e21806b946fe944a27fc273407f357ea1.tar.xz
ipxe-7c395b0e21806b946fe944a27fc273407f357ea1.zip
[build] Use -no-pie on newer versions of gcc
Some distributions patch gcc to generate position independent executables by default. We currently include a workaround to check for this and to add -fno-PIE -nopie to CFLAGS if required. Newer patched versions of gcc require -fno-PIE -no-pie instead. Check for both variants. Reported-by: Nathan Rennie-Waldock <nathan.renniewaldock@gmail.com> Originally-fixed-by: Markos Chandras <mchandras@suse.de> Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch')
-rw-r--r--src/arch/i386/Makefile11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/arch/i386/Makefile b/src/arch/i386/Makefile
index fe3adc9c..b7c2792d 100644
--- a/src/arch/i386/Makefile
+++ b/src/arch/i386/Makefile
@@ -74,10 +74,15 @@ CFLAGS += -Ui386
# recognise an option that starts with "no", so we have to test for
# output on stderr instead of checking the exit status.
#
+# Current versions of gcc require -no-pie; older versions require
+# -nopie. We therefore test for both.
+#
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)
+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')
+PIE_TEST2 = [ -z "`$(CC) -fno-PIE -nopie -x c -c /dev/null -o /dev/null 2>&1`" ]
+PIE_FLAGS2 := $(shell $(PIE_TEST2) && $(ECHO) '-fno-PIE -nopie')
+WORKAROUND_CFLAGS += $(PIE_FLAGS) $(PIE_FLAGS2)
endif
# i386-specific directories containing source files