Disable GCC's stack protector. Works with older GCC's by using Linux's cc-option function.

Thanks again for GPL'ing KQEMU :-)

Regards,

Anthony Liguori
--- a/common/Makefile	2007-02-05 16:57:37.000000000 -0600
+++ b/common/Makefile	2007-02-05 18:16:41.000000000 -0600
@@ -21,6 +21,12 @@
 #ARCH=i386
 #ARCH=x86_64
 
+# From the Linux kernel
+# cc-option
+# Usage: cflags-y += $(call cc-option,$(CC),-march=winchip-c6,-march=i586)
+cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
+              /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
+
 HOST_CC=gcc
 MON_CC=gcc
 MON_LD=ld
@@ -44,6 +50,11 @@
 CFLAGS=$(COMMON_CFLAGS)
 MON_CFLAGS=$(COMMON_CFLAGS)
 KERNEL_CFLAGS=$(COMMON_CFLAGS)
+
+# Disable SSP if GCC supports it.
+MON_CFLAGS+=$(call cc-option,$(CC),-fno-stack-protector,)
+MON_CFLAGS+=$(call cc-option,$(CC),-fno-stack-protector-all,)
+
 ifeq ($(ARCH), x86_64)
 KERNEL_CFLAGS+=-mcmodel=kernel
 MON_CFLAGS+= -fpic # needed for correct computed goto relocations
_______________________________________________
Qemu-devel mailing list
Qemu-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/qemu-devel

Reply via email to