Dear Joe Hershberger, > Hi Marek, [...]
It's a RFC, lemme explain: > > -$(obj)u-boot-spl.lds: $(LDSCRIPT) depend > > +$(obj)u-boot-spl.lst: $(LIBS) > > + $(OBJDUMP) -h $(LIBS) | \ Dump the section headers in all object files > > + sed -n -e 's/.*\(\.u_boot_list[^ ]\+\).*$$/\1/p' | \ Filter only \.u_boot_list.* symbols > > + sed 's/\.[^\.]\+$$//' | \ Remove the last .[^.]$ from each line. That's because the last part behind . is the name of the variable, we don't need that for generation of subsection boundary symbols. > > + sed -n ':s /^.\+$$/ { p;s/^\(.*\)\.[^\.]*$$/\1/;b s }' | \ For each line in format .u_boot_list.x.y.z, generate a list of as such (list of substrings with . as separator): .u_boot_list.x.y.z .u_boot_list.x.y .u_boot_list.x .u_boot_list > > + sed -n 's/\./.#/g;h;s/$$/\a/p;g;s/$$/@/p;g;s/$$/~/p;' | \ For each line, print the line thrice, first time append \a at the end, second @ and third ~. Also replace each dot with .# . See [1] and look for the list under "The order_end Keyword" section. > > + LC_COLLATE=C sort -u | \ Sort the list, it's imperative to use the C collating here, because of [1]. This results in lines ending with \a float above all lines ending with either @ or continuing with further dots. Same goes for ~, which falls at the end. > > + sed 's/#//g' | \ Remove the hashes. > > + sed -n -e '/\a$$/ { s/\./_/g;s/\a$$/__start = .;/p; }'\ > > + -e '/~$$/ { s/\./_/g;s/~$$/__end = .;/p; }'\ > > + -e '/@$$/ { s/\(.*\)@$$/*(SORT(\1.*));/p }' >$@ Replace \a with __start ... so this defines the subsection start marker, ~ with __end for subsection end marker and lines ending with @ with the SORT(subsection.*) so they catch the contents of subsection. > Could you not reuse this complicated logic by defining a make function > and then call + eval it? Something like this: Can you elaborate more? I don't quite get it ... :-( > define list_rule_template > $(1) : $(2) > $(OBJDUMP) -h $^ | \ > sed -n -e 's/.*\(\.u_boot_list[^ ]\+\).*$$/\1/p' | \ > sed 's/\.[^\.]\+$$//' | \ > sed -n ':s /^.\+$$/ { p;s/^\(.*\)\.[^\.]*$$/\1/;b s }' | \ > sed -n 's/\./.#/g;h;s/$$/\a/p;g;s/$$/@/p;g;s/$$/~/p;' | \ > LC_COLLATE=C sort -u | \ > sed 's/#//g' | \ > sed -n -e '/\a$$/ { s/\./_/g;s/\a$$/__start = .;/p; }'\ > -e '/~$$/ { s/\./_/g;s/~$$/__end = .;/p; }'\ > -e '/@$$/ { s/\(.*\)@$$/*(SORT(\1.*));/p }' >$@ > endef > ... > $(eval $(call list_rule_template,$(obj)u-boot.lst,$(LIBBOARD) $(LIBS))) > ... > $(eval $(call list_rule_template,$(obj)u-boot-spl.lst,$(LIBS))) > > > + > > +$(obj)u-boot-spl.lds: $(LDSCRIPT) $(obj)u-boot-spl.lst depend > > > > $(CPP) $(CPPFLAGS) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ -P - < $< > > > $@ > > -Joe [1] http://pubs.opengroup.org/onlinepubs/007908799/xbd/locale.html Best regards, Marek Vasut _______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot