aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>2004-11-14 15:55:50 +0000
committerkaf24@freefall.cl.cam.ac.uk <kaf24@freefall.cl.cam.ac.uk>2004-11-14 15:55:50 +0000
commitf8beb54e245538a1d5d724fe5a0fa48011483daf (patch)
tree26e41033ddbd33fa44526af2e33ba4f32110f383
parentadafcbebd29e4d229ed5b0dd339d5f2447885031 (diff)
downloadxen-f8beb54e245538a1d5d724fe5a0fa48011483daf.tar.gz
xen-f8beb54e245538a1d5d724fe5a0fa48011483daf.tar.bz2
xen-f8beb54e245538a1d5d724fe5a0fa48011483daf.zip
bitkeeper revision 1.1159.170.21 (41978006yk1bg04SJNSN2JWccT5adA)
Disable PIE/SSP features when building Xen, if GCC supports them.
-rw-r--r--xen/Rules.mk4
-rw-r--r--xen/arch/x86/Rules.mk6
2 files changed, 9 insertions, 1 deletions
diff --git a/xen/Rules.mk b/xen/Rules.mk
index ecb20cb35a..63c3a51784 100644
--- a/xen/Rules.mk
+++ b/xen/Rules.mk
@@ -39,6 +39,8 @@ ALL_OBJS += $(BASEDIR)/arch/$(TARGET_ARCH)/arch.o
HOSTCC = gcc
HOSTCFLAGS = -Wall -Wstrict-prototypes -O2 -fomit-frame-pointer
+test-gcc-flag = $(shell gcc -v --help 2>&1 | grep -q " $(1) " && echo $(1))
+
include $(BASEDIR)/arch/$(TARGET_ARCH)/Rules.mk
ifneq ($(debug),y)
@@ -62,6 +64,8 @@ ifeq ($(trace),y)
CFLAGS += -DTRACE_BUFFER
endif
+CFLAGS := $(strip $(CFLAGS))
+
%.o: %.c $(HDRS) Makefile
$(CC) $(CFLAGS) -c $< -o $@
diff --git a/xen/arch/x86/Rules.mk b/xen/arch/x86/Rules.mk
index fd4577f48c..bceb1982f4 100644
--- a/xen/arch/x86/Rules.mk
+++ b/xen/arch/x86/Rules.mk
@@ -14,10 +14,14 @@ else
x86_32/usercopy.o: CFLAGS += -O1
endif
-
# Prevent floating-point variables from creeping into Xen.
CFLAGS += -msoft-float
+# Disable PIE/SSP if GCC supports them. They can break us.
+CFLAGS += $(call test-gcc-flag,-nopie)
+CFLAGS += $(call test-gcc-flag,-fno-stack-protector)
+CFLAGS += $(call test-gcc-flag,-fno-stack-protector-all)
+
ifeq ($(TARGET_SUBARCH),x86_32)
CFLAGS += -m32 -march=i686
LDFLAGS := --oformat elf32-i386