[U-Boot] [RFC PATCH v1 3/9] Extend build-system for SPL framework

Aneesh V
2011-07-14T05:37:26Z

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