Message ID | 1310569869-31810-4-git-send-email-daniel.schwierzeck@googlemail.com |
---|---|
State | Superseded, archived |
Headers | show |
Dear Wolfgang, On Wednesday 13 July 2011 08:41 PM, Daniel Schwierzeck wrote: [snip ..] > gccincdir := $(shell $(CC) -print-file-name=include) > > +# Use section garbage collect for SPL if enabled by board config > +# and current ARCH, CPU or SOC did not enable it already > +ifeq ($(CONFIG_SPL_BUILD),y) > +ifeq ($(CONFIG_SPL_GC_SECTIONS),y) > +RELFLAGS += -ffunction-sections -fdata-sections > +LDFLAGS_FINAL += --gc-sections We were not sure whether to globally enable --gc-sections unconditionally for SPL or not. My opinion is that these flags should be globally enabled for all SPLs for the following reasons: 1. We chose only a few essential files per library for building the SPL libraries. There may be undefined references from some of the functions in the selected files to other files in the library. The functions that have these undefined references are those that are eventually not used by SPL. To avoid these linking errors we need --gc-sections 2. On the other hand if we built the libraries with all the files just as you would do in u-boot, we will definitely over step the internal RAM budget. So, in this case also we will need --gc-sections. As such I propose that the above shall be made un-conditional after taking care not to duplicate it if it's already defined in the platform config.mk for the u-boot. What do you think? best regards, Aneesh
Dear Aneesh, In message <4E1E8096.2000307@ti.com> you wrote: > > We were not sure whether to globally enable --gc-sections > unconditionally for SPL or not. My opinion is that these flags should > be globally enabled for all SPLs for the following reasons: ... > As such I propose that the above shall be made un-conditional after > taking care not to duplicate it if it's already defined in the platform > config.mk for the u-boot. I agree - we should enable these optimizations unconditionally. [Would duplication of these options be a problem? I don't think so - it's just bad for esthetic reasons.] Best regards, Wolfgang Denk
On Thursday 14 July 2011 03:15 PM, Wolfgang Denk wrote: > Dear Aneesh, > > In message<4E1E8096.2000307@ti.com> you wrote: >> >> We were not sure whether to globally enable --gc-sections >> unconditionally for SPL or not. My opinion is that these flags should >> be globally enabled for all SPLs for the following reasons: > ... >> As such I propose that the above shall be made un-conditional after >> taking care not to duplicate it if it's already defined in the platform >> config.mk for the u-boot. > > I agree - we should enable these optimizations unconditionally. > [Would duplication of these options be a problem? I don't think so - > it's just bad for esthetic reasons.] Yes, duplication will only make command line look ugly. I don't think it will result in any compilation issue. best regards, Aneesh
diff --git a/Makefile b/Makefile index 62c2078..9478059 100644 --- a/Makefile +++ b/Makefile @@ -104,10 +104,11 @@ $(if $(BUILD_DIR),,$(error output directory "$(saved-output)" does not exist)) endif # ifneq ($(BUILD_DIR),) OBJTREE := $(if $(BUILD_DIR),$(BUILD_DIR),$(CURDIR)) +SPLTREE := $(OBJTREE)/spl SRCTREE := $(CURDIR) TOPDIR := $(SRCTREE) LNDIR := $(OBJTREE) -export TOPDIR SRCTREE OBJTREE +export TOPDIR SRCTREE OBJTREE SPLTREE MKCONFIG := $(SRCTREE)/mkconfig export MKCONFIG diff --git a/config.mk b/config.mk index 2eb7fa2..8809d7a 100644 --- a/config.mk +++ b/config.mk @@ -23,19 +23,31 @@ ######################################################################### -ifneq ($(OBJTREE),$(SRCTREE)) ifeq ($(CURDIR),$(SRCTREE)) dir := else dir := $(subst $(SRCTREE)/,,$(CURDIR)) endif +ifneq ($(OBJTREE),$(SRCTREE)) +# Create object files for SPL in a separate directory +ifeq ($(CONFIG_SPL_BUILD),y) +obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/) +else obj := $(if $(dir),$(OBJTREE)/$(dir)/,$(OBJTREE)/) +endif src := $(if $(dir),$(SRCTREE)/$(dir)/,$(SRCTREE)/) $(shell mkdir -p $(obj)) else +# Create object files for SPL in a separate directory +ifeq ($(CONFIG_SPL_BUILD),y) +obj := $(if $(dir),$(SPLTREE)/$(dir)/,$(SPLTREE)/) + +$(shell mkdir -p $(obj)) +else obj := +endif src := endif @@ -158,12 +170,29 @@ OBJCFLAGS += --gap-fill=0xff gccincdir := $(shell $(CC) -print-file-name=include) +# Use section garbage collect for SPL if enabled by board config +# and current ARCH, CPU or SOC did not enable it already +ifeq ($(CONFIG_SPL_BUILD),y) +ifeq ($(CONFIG_SPL_GC_SECTIONS),y) +RELFLAGS += -ffunction-sections -fdata-sections +LDFLAGS_FINAL += --gc-sections +endif +endif + CPPFLAGS := $(DBGFLAGS) $(OPTFLAGS) $(RELFLAGS) \ -D__KERNEL__ ifneq ($(CONFIG_SYS_TEXT_BASE),) CPPFLAGS += -DCONFIG_SYS_TEXT_BASE=$(CONFIG_SYS_TEXT_BASE) endif +ifneq ($(CONFIG_SPL_TEXT_BASE),) +CPPFLAGS += -DCONFIG_SPL_TEXT_BASE=$(CONFIG_SPL_TEXT_BASE) +endif + +ifeq ($(CONFIG_SPL_BUILD),y) +CPPFLAGS += -DCONFIG_SPL_BUILD +endif + ifneq ($(RESET_VECTOR_ADDRESS),) CPPFLAGS += -DRESET_VECTOR_ADDRESS=$(RESET_VECTOR_ADDRESS) endif @@ -206,6 +235,11 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),) LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) endif +LDFLAGS_u-boot-spl += -T $(obj)u-boot-spl.lds $(LDFLAGS_FINAL) +ifneq ($(CONFIG_SPL_TEXT_BASE),) +LDFLAGS_u-boot-spl += -Ttext $(CONFIG_SPL_TEXT_BASE) +endif + # Location of a usable BFD library, where we define "usable" as # "built for ${HOST}, supports ${TARGET}". Sensible values are # - When cross-compiling: the root of the cross-environment