[coreboot-gerrit] New patch to review for coreboot: 1c8cafe build: Add ccopts back into the build

Marc Jones (marc.jones@se-eng.com) gerrit at coreboot.org
Fri Nov 7 07:48:27 CET 2014


Marc Jones (marc.jones at se-eng.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/7352

-gerrit

commit 1c8cafe293c6b905543f8fe7971256d429d2f494
Author: Marc Jones <marc.jones at se-eng.com>
Date:   Thu Nov 6 15:50:22 2014 -0700

    build: Add ccopts back into the build
    
    The ccopts mechanism is needed for passing ARM assembler flags to GCC.
    There are many gotchas in adding ASFLAGS. As things have moved
    around, the revert doesn't remove cleanly, so this reverts and cleans
    up the ccopts.
    
    This reverts commit 25b56c3af514faa8a730d56fe14cae4960ac83aa.
    
    Change-Id: I44c025535258e6afb05a814123c10c24775a88e8
    Signed-off-by: Marc Jones <marc.jones at se-eng.com>
---
 Makefile                        |  9 +++++----
 Makefile.inc                    | 24 ++++++++++++++----------
 src/arch/arm/armv4/Makefile.inc | 12 ++++++------
 src/arch/arm/armv7/Makefile.inc | 12 ++++++------
 toolchain.inc                   |  4 ++--
 5 files changed, 33 insertions(+), 28 deletions(-)

diff --git a/Makefile b/Makefile
index fa42101..eaac22b 100644
--- a/Makefile
+++ b/Makefile
@@ -219,12 +219,13 @@ alldirs:=$(sort $(abspath $(dir $(allobjs))))
 define create_cc_template
 # $1 obj class
 # $2 source suffix (c, S)
-# $3 additional dependencies
+# $3 additional compiler flags
+# $4 additional dependencies
 ifn$(EMPTY)def $(1)-objs_$(2)_template
 de$(EMPTY)fine $(1)-objs_$(2)_template
-$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(3)
+$(obj)/$$(1).$(1).o: src/$$(1).$(2) $(obj)/config.h $(4)
 	@printf "    CC         $$$$(subst $$$$(obj)/,,$$$$(@))\n"
-	$(CC_$(1)) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -c -o $$$$@ $$$$<
+	$(CC_$(1)) $(3) -MMD $$$$(CPPFLAGS_$(1)) $$$$(CFLAGS_$(1)) -c -o $$$$@ $$$$<
 en$(EMPTY)def
 end$(EMPTY)if
 endef
@@ -232,7 +233,7 @@ endef
 filetypes-of-class=$(subst .,,$(sort $(suffix $($(1)-srcs))))
 $(foreach class,$(classes), \
 	$(foreach type,$(call filetypes-of-class,$(class)), \
-		$(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-deps)))))
+		$(eval $(call create_cc_template,$(class),$(type),$($(class)-$(type)-ccopts),$($(class)-$(type)-deps)))))
 
 foreach-src=$(foreach file,$($(1)-srcs),$(eval $(call $(1)-objs_$(subst .,,$(suffix $(file)))_template,$(subst src/,,$(basename $(file))))))
 $(eval $(foreach class,$(classes),$(call foreach-src,$(class))))
diff --git a/Makefile.inc b/Makefile.inc
index 934755f..1aa4dde 100644
--- a/Makefile.inc
+++ b/Makefile.inc
@@ -115,12 +115,13 @@ ramstage-postprocess=$(foreach d,$(sort $(dir $(1))), \
 	$(eval $(d)ramstage.o: $(call files-in-dir,$(d),$(1)); $$(LD_ramstage) -o $$@ -r $$^ ) \
 	$(eval ramstage-objs:=$(d)ramstage.o $(filter-out $(call files-in-dir,$(d),$(1)),$(ramstage-objs))))
 
-CPPFLAGS_romstage += -D__PRE_RAM__
+romstage-c-ccopts:=-D__PRE_RAM__
+romstage-S-ccopts:=-D__PRE_RAM__
 ifeq ($(CONFIG_TRACE),y)
-CFLAGS_ramstage += -finstrument-functions
+ramstage-c-ccopts:= -finstrument-functions
 endif
 ifeq ($(CONFIG_COVERAGE),y)
-CFLAGS_ramstage += -fprofile-arcs -ftest-coverage
+ramstage-c-ccopts+=-fprofile-arcs -ftest-coverage
 endif
 
 # try to fetch non-optional submodules
@@ -131,15 +132,18 @@ ifeq ($(CONFIG_USE_BLOBS),y)
 forgetthis:=$(shell git submodule update --init --checkout 3rdparty)
 endif
 
-CPPFLAGS_bootblock += -D__BOOT_BLOCK__ -D__PRE_RAM__
+bootblock-c-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
+bootblock-S-ccopts:=-D__BOOT_BLOCK__ -D__PRE_RAM__
 
-CPPFLAGS_smmstub += -D__SMM__
-CPPFLAGS_smm += -D__SMM__
+smmstub-c-ccopts:=-D__SMM__
+smmstub-S-ccopts:=-D__SMM__
+smm-c-ccopts:=-D__SMM__
+smm-S-ccopts:=-D__SMM__
 
 # SMM TSEG base is dynamic
 ifneq ($(CONFIG_SMM_MODULES),y)
 ifeq ($(CONFIG_SMM_TSEG),y)
-CFLAGS_smm += -fpic
+smm-c-ccopts += -fpic
 endif
 endif
 
@@ -337,15 +341,15 @@ $(objutil)/%.o: $(objutil)/%.c
 
 $(obj)/%.ramstage.o $(abspath $(obj))/%.ramstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
-	$(CC_ramstage) -MMD $(CFLAGS_ramstage) $(CPPFLAGS_ramstage) -c -o $@ $<
+	$(CC_ramstage) -MMD $(CFLAGS_ramstage) $(CPPFLAGS_ramstage) $(ramstage-c-ccopts) -c -o $@ $<
 
 $(obj)/%.romstage.o $(abspath $(obj))/%.romstage.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
-	$(CC_romstage) -MMD -D__PRE_RAM__ $(CFLAGS_romstage) $(CPPFLAGS_romstage) -c -o $@ $<
+	$(CC_romstage) -MMD $(CFLAGS_romstage) $(CPPFLAGS_romstage) $(romstage-c-ccopts) -c -o $@ $<
 
 $(obj)/%.bootblock.o $(abspath $(obj))/%.bootblock.o: $(obj)/%.c $(obj)/config.h $(OPTION_TABLE_H)
 	@printf "    CC         $(subst $(obj)/,,$(@))\n"
-	$(CC_bootblock) -MMD $(CFLAGS_bootblock) $(CPPFLAGS_bootblock) -c -o $@ $<
+	$(CC_bootblock) -MMD $(CFLAGS_bootblock) $(CPPFLAGS_bootblock) $(bootblock-c-ccopts) -c -o $@ $<
 
 #######################################################################
 # Clean up rules
diff --git a/src/arch/arm/armv4/Makefile.inc b/src/arch/arm/armv4/Makefile.inc
index aa78868..6b516b9 100644
--- a/src/arch/arm/armv4/Makefile.inc
+++ b/src/arch/arm/armv4/Makefile.inc
@@ -35,8 +35,8 @@ endif
 
 bootblock-y += cache.c
 
-CFLAGS_bootblock += $(armv4_flags)
-CPPFLAGS_bootblock += $(armv4_flags)
+bootblock-c-ccopts += $(armv4_flags)
+bootblock-S-ccopts += $(armv4_flags)
 
 endif # CONFIG_ARCH_BOOTBLOCK_ARMV4
 
@@ -47,8 +47,8 @@ endif # CONFIG_ARCH_BOOTBLOCK_ARMV4
 ifeq ($(CONFIG_ARCH_ROMSTAGE_ARMV4),y)
 
 
-CFLAGS_romstage += $(armv4_flags)
-CPPFLAGS_romstage += $(armv4_flags)
+romstage-c-ccopts += $(armv4_flags)
+romstage-S-ccopts += $(armv4_flags)
 
 endif # CONFIG_ARCH_ROMSTAGE_ARMV4
 
@@ -58,7 +58,7 @@ endif # CONFIG_ARCH_ROMSTAGE_ARMV4
 
 ifeq ($(CONFIG_ARCH_RAMSTAGE_ARMV4),y)
 
-CFLAGS_ramstage += $(armv4_flags)
-CPPFLAGS_ramstage += $(armv4_flags)
+ramstage-c-ccopts += $(armv4_flags)
+ramstage-S-ccopts += $(armv4_flags)
 
 endif # CONFIG_ARCH_RAMSTAGE_ARMV4
diff --git a/src/arch/arm/armv7/Makefile.inc b/src/arch/arm/armv7/Makefile.inc
index c46fb39..4f3e757 100644
--- a/src/arch/arm/armv7/Makefile.inc
+++ b/src/arch/arm/armv7/Makefile.inc
@@ -39,8 +39,8 @@ bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += exception.c
 bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += exception_asm.S
 bootblock-y += mmu.c
 
-CFLAGS_bootblock += $(armv7_flags)
-CPPFLAGS_bootblock += $(armv7_flags)
+bootblock-c-ccopts += $(armv7_flags)
+bootblock-S-ccopts += $(armv7_flags)
 
 endif # CONFIG_ARCH_BOOTBLOCK_ARMV7
 
@@ -56,8 +56,8 @@ romstage-y += exception.c
 romstage-y += exception_asm.S
 romstage-y += mmu.c
 
-CFLAGS_romstage += $(armv7_flags)
-CPPFLAGS_romstage += $(armv7_flags)
+romstage-c-ccopts += $(armv7_flags)
+romstage-S-ccopts += $(armv7_flags)
 
 endif # CONFIG_ARCH_ROMSTAGE_ARMV7
 
@@ -73,7 +73,7 @@ ramstage-y += exception.c
 ramstage-y += exception_asm.S
 ramstage-y += mmu.c
 
-CFLAGS_ramstage += $(armv7_flags)
-CPPFLAGS_ramstage += $(armv7_flags)
+ramstage-c-ccopts += $(armv7_flags)
+ramstage-S-ccopts += $(armv7_flags)
 
 endif # CONFIG_ARCH_RAMSTAGE_ARMV7
diff --git a/toolchain.inc b/toolchain.inc
index 1f95b6b..0ed370f 100644
--- a/toolchain.inc
+++ b/toolchain.inc
@@ -90,8 +90,8 @@ OBJCOPY_$(1) := $(OBJCOPY_$(2))
 OBJDUMP_$(1) := $(OBJDUMP_$(2))
 STRIP_$(1) := $(STRIP_$(2))
 READELF_$(1) := $(READELF_$(2))
-CFLAGS_$(1) += $$(CFLAGS_common) $$(CFLAGS_$(2))
-CPPFLAGS_$(1) += $$(CPPFLAGS_common) $$(CPPFLAGS_$(2))
+CFLAGS_$(1) = $$(CFLAGS_common) $$(CFLAGS_$(2))
+CPPFLAGS_$(1) = $$(CPPFLAGS_common) $$(CPPFLAGS_$(2))
 LIBGCC_FILE_NAME_$(1) = $(wildcard $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-libgcc-file-name))
 LIBCLANG_RT_FILE_NAME_$(1) = $(shell $(CC_$(2)) $(CFLAGS_$(2)) -print-librt-file-name 2>/dev/null)
 endef



More information about the coreboot-gerrit mailing list