[coreboot] [openvsa] Fix for 64 bit hosts and Ubuntu

Jordan Crouse jordan.crouse at amd.com
Fri Feb 8 22:37:19 CET 2008


Patch to allow compiling on 64 bit hosts as well as that oldy but
goody, -fno-stack-protector.

Jordan
-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.
-------------- next part --------------
[openvsa] Fix for 64 bit hosts, and add in our good friend -fno-stack-protector

Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>
Index: openvsa/common.mk
===================================================================
--- openvsa.orig/common.mk	2008-02-08 13:25:27.000000000 -0700
+++ openvsa/common.mk	2008-02-08 14:17:27.000000000 -0700
@@ -19,11 +19,26 @@
 # along with openvsa.  If not, see <http://www.gnu.org/licenses/>.
 #
 
+# Borrowed from the kernel
+
+try-run= $(shell set -e; \
+	TMP=".$$$$.tmp"; \
+	if ($(1)) > /dev/null 2>&1; \
+	then echo "$(2)"; \
+	else echo "$(3)"; \
+	fi; rm -rf "$$TMP")
+
+
+cc-option= $(call try-run, \
+	$(CC) $(1) -S -xc /dev/null -o "$$TMP", $(1), $(2))
+
 CC      = gcc
 INCS    = $(addprefix -I, ../inc ../sysmgr)
 ARCH    = i586
-CFLAGS += -Wall -Werror -fno-strict-aliasing -march=$(ARCH) -Os $(INCS)
+CFLAGS += -m32 -Wall -Werror -fno-strict-aliasing -march=$(ARCH) -Os $(INCS)
+LDFLAGS += -melf_i386
 
+CFLAGS += $(call cc-option, -fno-stack-protector,)
 # --------------------------------------------------------------------------
 
 SMMDC_TRANSLATE    = ../smimac.pl < $< > tmp_$<
Index: openvsa/sysmgr/Makefile
===================================================================
--- openvsa.orig/sysmgr/Makefile	2008-02-08 13:32:50.000000000 -0700
+++ openvsa/sysmgr/Makefile	2008-02-08 13:43:46.000000000 -0700
@@ -38,7 +38,7 @@
 EXTRA_CLEANS = $(INIT_ASM_OBJ)
 
 vsainit.bin : $(INIT_ASM_OBJ) vsainit.lnk
-	$(LD) --cref --oformat binary -Map vsainit.map \
+	$(LD) $(LDFLAGS) --cref --oformat binary -Map vsainit.map \
 		-o $@ -T vsainit.lnk $(INIT_ASM_OBJ)
 clean::
 	$(RM) vsainit.map
@@ -58,7 +58,7 @@
 # Note: gcc 4.1.1 barfs on chipset.c with '-Os'
 chipset.o : chipset.c 
 	@mkdir -p .deps
-	$(CC) -march=$(ARCH) $(INCS) -MD -c -o $@ $<
+	$(CC) -m32 -march=$(ARCH) $(INCS) -MD -c -o $@ $<
 	@cp chipset.d .deps/chipset.P; \
 		sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \
 		-e '/^$$/ d' -e 's/$$/ :/' < chipset.d >> \
Index: openvsa/vsm.mk
===================================================================
--- openvsa.orig/vsm.mk	2008-02-08 13:32:08.000000000 -0700
+++ openvsa/vsm.mk	2008-02-08 13:32:23.000000000 -0700
@@ -25,7 +25,7 @@
 all : $(VSM).vsm $(EXTRA_BIN)
 
 $(VSM).vsm : $(ASM_OBJ) $(C_OBJ) ../vsm_lib/vsm.a $(VSM).lnk
-	$(LD) --cref --oformat binary -Map $(VSM).map \
+	$(LD) $(LDFLAGS) --cref --oformat binary -Map $(VSM).map \
 		-o $@ -T $(VSM).lnk $(ASM_OBJ) $(C_OBJ) ../vsm_lib/vsm.a
 
 ../vsm_lib/vsm.a:


More information about the coreboot mailing list