[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] Fix tools Makefiles to respect CFLAGS. Disable stack-smash



# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID e5aba4f62131528f7f5526f7807784439aa2b8e2
# Parent  e77ea156075cd9c8eeb942efbf5a8cdb1c33eb09
Fix tools Makefiles to respect CFLAGS. Disable stack-smash
protection when building vmxassist/hvmloader.

Signed-off-by: Keir Fraser <keir@xxxxxxxxxxxxx>

diff -r e77ea156075c -r e5aba4f62131 tools/firmware/hvmloader/Makefile
--- a/tools/firmware/hvmloader/Makefile Tue Feb 28 10:07:18 2006
+++ b/tools/firmware/hvmloader/Makefile Tue Feb 28 10:41:54 2006
@@ -19,7 +19,7 @@
 #
 
 XEN_ROOT = ../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/Config.mk
 
 # The HVM loader is started in 32-bit mode at the address below:
 LOADADDR = 0x100000
@@ -29,9 +29,13 @@
 
 OBJECTS         = hvmloader.o acpi_madt.o 
 
-CC       = gcc
+# Disable PIE/SSP if GCC supports them. They can break us.
+CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
+CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
+CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
+
 OBJCOPY  = objcopy
-CFLAGS   = $(DEFINES) -I. $(XENINC) -Wall -fno-builtin -O2 -msoft-float
+CFLAGS  += $(DEFINES) -I. $(XENINC) -Wall -fno-builtin -O2 -msoft-float
 CFLAGS  += -m32 -march=i686
 LDFLAGS  = -m32 -nostdlib -Wl,-N -Wl,-Ttext -Wl,$(LOADADDR)
 
diff -r e77ea156075c -r e5aba4f62131 tools/firmware/vgabios/Makefile
--- a/tools/firmware/vgabios/Makefile   Tue Feb 28 10:07:18 2006
+++ b/tools/firmware/vgabios/Makefile   Tue Feb 28 10:41:54 2006
@@ -1,6 +1,4 @@
 CC      = gcc
-CFLAGS  = -g -O2 -Wall -Wstrict-prototypes
-LDFLAGS = 
 
 GCC = gcc
 BCC = bcc
diff -r e77ea156075c -r e5aba4f62131 tools/firmware/vmxassist/Makefile
--- a/tools/firmware/vmxassist/Makefile Tue Feb 28 10:07:18 2006
+++ b/tools/firmware/vmxassist/Makefile Tue Feb 28 10:41:54 2006
@@ -19,7 +19,7 @@
 #
 
 XEN_ROOT = ../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/Config.mk
 
 # The emulator code lives in ROM space
 TEXTADDR=0x000D0000
@@ -27,11 +27,14 @@
 DEFINES=-DDEBUG -DTEXTADDR=$(TEXTADDR)
 XENINC=-I$(XEN_ROOT)/tools/libxc
 
-LD       = ld
-CC       = gcc
+# Disable PIE/SSP if GCC supports them. They can break us.
+CFLAGS  += $(call test-gcc-flag,$(CC),-nopie)
+CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector)
+CFLAGS  += $(call test-gcc-flag,$(CC),-fno-stack-protector-all)
+
 CPP      = cpp -P
 OBJCOPY  = objcopy -p -O binary -R .note -R .comment -R .bss -S --gap-fill=0
-CFLAGS   = $(DEFINES) -I. $(XENINC) -Wall -fno-builtin -O2 -msoft-float
+CFLAGS  += $(DEFINES) -I. $(XENINC) -Wall -fno-builtin -O2 -msoft-float
 CFLAGS  += -m32 -march=i686
 LDFLAGS  = -m elf_i386
 
diff -r e77ea156075c -r e5aba4f62131 tools/ioemu/Makefile
--- a/tools/ioemu/Makefile      Tue Feb 28 10:07:18 2006
+++ b/tools/ioemu/Makefile      Tue Feb 28 10:41:54 2006
@@ -1,6 +1,9 @@
+XEN_ROOT=../..
+include $(XEN_ROOT)/tools/Rules.mk
+
 -include config-host.mak
 
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing 
+CFLAGS+=-Wall -O2 -g -fno-strict-aliasing 
 ifdef CONFIG_DARWIN
 CFLAGS+= -mdynamic-no-pic
 endif
diff -r e77ea156075c -r e5aba4f62131 tools/ioemu/target-i386-dm/Makefile
--- a/tools/ioemu/target-i386-dm/Makefile       Tue Feb 28 10:07:18 2006
+++ b/tools/ioemu/target-i386-dm/Makefile       Tue Feb 28 10:41:54 2006
@@ -1,7 +1,8 @@
+include config.mak
+override TARGET_ARCH=i386
+
 XEN_ROOT=../../..
 include $(XEN_ROOT)/tools/Rules.mk
-include config.mak
-override TARGET_ARCH=i386
 
 INSTALL_DIR := $(DESTDIR)/usr/$(LIBDIR)/xen/bin
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
@@ -12,7 +13,7 @@
 VPATH+=:$(SRC_PATH)/linux-user
 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
 endif
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing
+CFLAGS+=-Wall -O2 -g -fno-strict-aliasing
 LDFLAGS=-g
 LIBS=
 HELPER_CFLAGS=$(CFLAGS)
diff -r e77ea156075c -r e5aba4f62131 tools/tests/Makefile
--- a/tools/tests/Makefile      Tue Feb 28 10:07:18 2006
+++ b/tools/tests/Makefile      Tue Feb 28 10:41:54 2006
@@ -4,13 +4,12 @@
 
 TARGET := test_x86_emulator
 
-CC     := gcc
-CFLAGS := -O2 -Wall -Werror -D__TEST_HARNESS__
+HOSTCFLAGS += -D__TEST_HARNESS__
 
 all: $(TARGET)
 
 $(TARGET): x86_emulate.o test_x86_emulator.o
-       $(CC) -o $@ $^
+       $(HOSTCC) -o $@ $^
 
 clean:
        rm -rf $(TARGET) *.o *~ core
@@ -18,7 +17,7 @@
 install:
 
 x86_emulate.o: $(XEN_ROOT)/xen/arch/x86/x86_emulate.c
-       $(CC) $(CFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<
+       $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<
 
 %.o: %.c
-       $(CC) $(CFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<
+       $(HOSTCC) $(HOSTCFLAGS) -I$(XEN_ROOT)/xen/include -c -o $@ $<

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.