[U-Boot] [Nios2-dev] [PATCH] nios2: use gc sections to reduce image size

Ian Abbott abbotti at mev.co.uk
Fri May 28 11:27:10 CEST 2010


On 28/05/2010 05:08, Thomas Chou wrote:
> Follow the discussion of Charles Manning and Mike Frysinger.
> Using gc_sections helps reduce image size.
> 
> Configuring for nios2-generic board...
> Before,
>    text    data     bss     dec     hex filename
>  123979    3724   22892  150595   24c43 /tmp/u-boot/u-boot
> After,
>    text    data     bss     dec     hex filename
>  115983    3800   22732  142515   22cb3 /tmp/u-boot/u-boot
> 
> Signed-off-by: Thomas Chou <thomas at wytron.com.tw>
> ---
>  arch/nios2/config.mk |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/nios2/config.mk b/arch/nios2/config.mk
> index 793cc43..aba96b3 100644
> --- a/arch/nios2/config.mk
> +++ b/arch/nios2/config.mk
> @@ -31,2 +31,5 @@ PLATFORM_CPPFLAGS += -DCONFIG_NIOS2 -D__NIOS2__
>  
>  LDSCRIPT ?= $(SRCTREE)/$(CPUDIR)/u-boot.lds
> +
> +LDFLAGS += --gc-sections
> +PLATFORM_RELFLAGS += -ffunction-sections -fdata-sections

Hi Thomas,

Will that stop it working with the gcc3-based nios2 nommu toolchain?
The version of 'ld' in that toolchain doesn't support the --gc-sections
option.

-- 
-=( Ian Abbott @ MEV Ltd.    E-mail: <abbotti at mev.co.uk>             )=-
-=( Tel: +44 (0)161 477 1898   FAX: +44 (0)161 718 3587              )=-


More information about the U-Boot mailing list