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

Wolfgang Denk wd at denx.de
Tue Sep 25 22:12:04 CEST 2012


Dear Marek Vasut,

In message <1348589520-14395-2-git-send-email-marex at denx.de> you wrote:
> 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.
...
> --- a/Makefile
> +++ b/Makefile
> @@ -510,7 +510,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`;\
> +		cd $(LNDIR) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
> +			$$UNDEF_SYM $$UNDEF_LST $(__OBJS) \

I dislike the exact duplication of the commands here.

Would it not make sense to provide some function / script to do that?


> +$(eval $(call make_u_boot_list, $(obj)u-boot.lst, $(LIBBOARD) $(LIBS)))
> +$(obj)u-boot.lds: $(LDSCRIPT) $(obj)u-boot.lst
> +		$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@

I think this needs a comment to explain what sort of magic you are
invoking here.

...
> --- /dev/null
> +++ b/helper.mk
...
> +	$(OBJDUMP) -h $(2) | \
> +	sed -n -e 's/.*\(\.u_boot_list[^ ]\+\).*$$$$/\1/p' | \
> +	sed 's/\.[^\.]\+$$$$//' | \
> +	sed -n ':s /^.\+$$$$/ { p;s/^\(.*\)\.[^\.]*$$$$/\1/;b s }' | \
> +	sed -n 'h;s/$$$$/\a/p;g;s/$$$$/@/p;g;s/$$$$/~/p;' | \
...

Why exactly do you need 4 invocations of sed here?  Seems just like a
waste of processes to me.

>  LDSCRIPT= $(TOPDIR)/$(CPUDIR)/u-boot-nand_spl.lds
> +LSTSCRIPT= $(TOPDIR)/nand_spl/board/$(BOARDDIR)/u-boot.lst

BTW:  what exactly is "LST" supposed to mean?

> +$(eval $(call make_u_boot_list, $(LSTSCRIPT), $(__OBJS)))
> +$(nandobj)u-boot-nand_spl.lds: $(LDSCRIPT) $(LSTSCRIPT)
> +	$(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - <$< >$@

Comment needed.


Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Ein weiser Herrscher kann in einem großen Land  mehr  Gutes  bewirken
als  in  einem kleinen - ein dummer Herrscher aber auch viel mehr Un-
fug. Da weise Herrscher seltener sind als dumme, war ich schon  immer
gegen große Reiche skeptisch.                   - Herbert Rosendorfer


More information about the U-Boot mailing list