[U-Boot] [PATCH 1/6 V3] common: Add symbol handling for generic lists into Makefile

Daniel Schwierzeck daniel.schwierzeck at gmail.com
Mon Oct 15 01:28:59 CEST 2012


2012/10/12 Marek Vasut <marex at denx.de>:
> This patch adds essential components for generation of the contents of
> the linker section that is used by the linker-generated array. All of
> the contents is held in a separate file, u-boot.lst, which is generated
> at runtime just before U-Boot is linked.
>
> The purpose of this code is to especially generate the appropriate
> boundary symbols around each subsection in the section carrying the
> linker-generated arrays. Obviously, the interim linker code for actual
> placement of the variables into the section is generated too. The
> generated file, u-boot.lst, is included into u-boot.lds via the linker
> INCLUDE directive in u-boot.lds .
>
> Adjustments are made in the Makefile and spl/Makefile so that the
> u-boot.lds and u-boot-spl.lds depend on their respective .lst files.
>
> Signed-off-by: Marek Vasut <marex at denx.de>
> Cc: Joe Hershberger <joe.hershberger at gmail.com>
> Cc: Mike Frysinger <vapier at gentoo.org>
>
> Cover-letter:
> Linker-generated arrays (take 2)
>
> This is a second stab at the linker-generated array. Basically, this
> concept is a generic abstraction of how u_boot_cmd works today. The
> patch 2/4 contains a huge pile of documentation which should clarify
> most of the questions.
>
> I don't see size growth, I see size fluctiation in the order of tens
> of bytes with these patches applied. Subsequent patch added to this
> series removes the __u_boot_cmd section completely.
> ---
>  .gitignore                                     |    1 +
>  Makefile                                       |   19 ++++---
>  config.mk                                      |    2 +
>  helper.mk                                      |   64 ++++++++++++++++++++++++
>  nand_spl/board/freescale/mpc8536ds/Makefile    |    9 +++-
>  nand_spl/board/freescale/mpc8569mds/Makefile   |    9 +++-
>  nand_spl/board/freescale/mpc8572ds/Makefile    |    9 +++-
>  nand_spl/board/freescale/mx31pdk/Makefile      |    9 +++-
>  nand_spl/board/freescale/p1010rdb/Makefile     |    9 +++-
>  nand_spl/board/freescale/p1023rds/Makefile     |    9 +++-
>  nand_spl/board/freescale/p1_p2_rdb/Makefile    |    9 +++-
>  nand_spl/board/freescale/p1_p2_rdb_pc/Makefile |    9 +++-
>  nand_spl/board/karo/tx25/Makefile              |    9 +++-
>  spl/.gitignore                                 |    1 +
>  spl/Makefile                                   |    8 ++-
>  15 files changed, 150 insertions(+), 26 deletions(-)
>  create mode 100644 helper.mk
>
> V2:
> - Rebase on top of testing/dm-kerneldoc
> - Fix INCLUDE u-boot.lds in linker scripts. It didn't work with older LD,
>   use #include instead and make use of CPP.
> - Fix placement of u-boot.lds for NAND SPL
> V3:
> - Rebase on top of u-boot/next
> - Put u-boot.lst into include/ , so the CPP finds it easily.
>
> diff --git a/.gitignore b/.gitignore
> index d91e91b..1ac43f2 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -38,6 +38,7 @@
>  /u-boot.sha1
>  /u-boot.dis
>  /u-boot.lds
> +/u-boot.lst
>  /u-boot.ubl
>  /u-boot.ais
>  /u-boot.dtb
> diff --git a/Makefile b/Makefile
> index ab34fa7..66c8c77 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -535,7 +535,10 @@ else
>  GEN_UBOOT = \
>                 UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
>                 sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\
> -               cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) $$UNDEF_SYM $(__OBJS) \
> +               UNDEF_LST=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
> +               sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_list_.*\)/-u\1/p'|sort|uniq`;\

this must be:

> +               sed  -n -e 's/.*\($(SYM_PREFIX)_u_boot_list_.*\)/-u\1/p'|sort|uniq`;\

otherwise $UNDEF_LST is always empty which breaks at least all MIPS
boards because
all _uboot_list_* symbols are discarded by the linker. I noticed that
on ARM and PowerPC
the content of $UNDEF_LST does not matter at all because those symbols
are always linked into the final binary.

I've pushed debug patches to git://git.denx.de/u-boot-mips.git
test/dm-lgarray-fixed
if you want to test it yourself. With those patches make and MAKEALL will fail
if the _uboot_list_cmd_* symbols are missing in the System.map.


BTW: you could actually drop this in patch 5/5 because it's not needed anymore:

>                 UNDEF_SYM=`$(OBJDUMP) -x $(LIBBOARD) $(LIBS) | \
>                 sed  -n -e 's/.*\($(SYM_PREFIX)__u_boot_cmd_.*\)/-u\1/p'|sort|uniq`;\

-- 
Best regards,
Daniel


More information about the U-Boot mailing list