[U-Boot] [PATCH v2] Introduce a new linker flag LDFLAGS_FINAL

Scott Wood scottwood at freescale.com
Tue Feb 22 21:47:12 CET 2011


On Tue, 22 Feb 2011 15:17:37 -0500
<Haiying.Wang at freescale.com> wrote:

> diff --git a/config.mk b/config.mk
> index 5147c35..caa6221 100644
> --- a/config.mk
> +++ b/config.mk
> @@ -205,8 +205,9 @@ endif
>  AFLAGS := $(AFLAGS_DEBUG) -D__ASSEMBLY__ $(CPPFLAGS)
>  
>  LDFLAGS += $(PLATFORM_LDFLAGS)
> +LDFLAGS_FINAL += -Bstatic $(LDFLAGS)
>  
> -LDFLAGS_u-boot += -Bstatic -T $(obj)u-boot.lds $(PLATFORM_LDFLAGS)
> +LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)
>  ifneq ($(CONFIG_SYS_TEXT_BASE),)
>  LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
>  endif

As Mike Frysinger pointed out, LDFLAGS is already used in addition to
LDFLAGS_u-boot.  So we may want to have LDFLAGS_FINAL not include LDFLAGS:

LDFLAGS += -Bstatic
LDFLAGS_u-boot += -T $(obj)u-boot.lds $(LDFLAGS_FINAL)

and then...

> diff --git a/nand_spl/board/freescale/mpc8536ds/Makefile b/nand_spl/board/freescale/mpc8536ds/Makefile
> index 9c9d63e..c71a35a 100644
> --- a/nand_spl/board/freescale/mpc8536ds/Makefile
> +++ b/nand_spl/board/freescale/mpc8536ds/Makefile
> @@ -30,7 +30,7 @@ PAD_TO := 0xfff01000
>  include $(TOPDIR)/config.mk
>  
>  LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
> -LDFLAGS	= -Bstatic -T $(LDSCRIPT) -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) $(PLATFORM_LDFLAGS)
> +LDFLAGS := -T $(LDSCRIPT) -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) $(LDFLAGS_FINAL)
>  AFLAGS	+= -DCONFIG_NAND_SPL
>  CFLAGS	+= -DCONFIG_NAND_SPL

LDFLAGS := -T $(LDSCRIPT) -Ttext $(CONFIG_SYS_TEXT_BASE_SPL) \
	   $(LDFLAGS) $(LDFLAGS_FINAL)

The only functional difference should be that we're no longer repeating
certain flags in the main u-boot link.

-Scott



More information about the U-Boot mailing list