From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] common: Add symbol handling for generic lists into Makefile
Date: Mon, 24 Sep 2012 18:04:25 +0200 [thread overview]
Message-ID: <201209241804.25793.marex@denx.de> (raw)
In-Reply-To: <CANr=Z=beUJTEcxHE+WGusoaPpcF5_Vc5pkMb0Ni82pjPb-d6aQ@mail.gmail.com>
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
next prev parent reply other threads:[~2012-09-24 16:04 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-24 1:21 [U-Boot] [RFC] [PATCH 0/3] Linker-generated arrays Marek Vasut
2012-09-24 1:21 ` [U-Boot] [PATCH 1/3] common: Add symbol handling for generic lists into Makefile Marek Vasut
2012-09-24 15:36 ` Joe Hershberger
2012-09-24 16:04 ` Marek Vasut [this message]
2012-09-24 17:00 ` Joe Hershberger
2012-09-24 17:08 ` Marek Vasut
2012-09-24 17:43 ` Joe Hershberger
2012-09-24 1:21 ` [U-Boot] [PATCH 2/3] common: Implement support for linker-generated arrays Marek Vasut
2012-09-24 16:30 ` Joe Hershberger
2012-09-24 16:52 ` Marek Vasut
2012-09-24 1:21 ` [U-Boot] [PATCH 3/3] common: Add .u_boot_list into all linker files Marek Vasut
2012-09-24 16:34 ` Joe Hershberger
2012-09-24 16:53 ` Marek Vasut
2012-09-24 17:06 ` Tom Rini
2012-09-24 17:09 ` Marek Vasut
2012-09-24 17:18 ` Tom Rini
2012-09-24 17:23 ` Joe Hershberger
2012-09-24 18:07 ` Tom Rini
2012-09-24 17:25 ` Marek Vasut
2012-09-24 17:29 ` [U-Boot] [RFC] [PATCH 0/3] Linker-generated arrays Tom Rini
2012-09-24 17:42 ` Marek Vasut
2012-09-25 16:11 ` [U-Boot] [RFC] [PATCH 0/3 v2] " Marek Vasut
2012-09-25 16:11 ` [U-Boot] [PATCH 1/3 V2] common: Add symbol handling for generic lists into Makefile Marek Vasut
2012-09-25 20:12 ` Wolfgang Denk
2012-09-25 20:22 ` Marek Vasut
2012-09-25 16:11 ` [U-Boot] [PATCH 2/3 V2] common: Implement support for linker-generated arrays Marek Vasut
2012-09-25 20:16 ` Wolfgang Denk
2012-09-25 20:24 ` Marek Vasut
2012-09-26 7:01 ` Wolfgang Denk
2012-09-26 16:53 ` Marek Vasut
2012-09-29 1:45 ` Joe Hershberger
2012-09-29 2:49 ` Marek Vasut
2012-09-25 16:12 ` [U-Boot] [PATCH 3/3 V2] common: Add .u_boot_list into all linker files Marek Vasut
2012-09-25 16:43 ` Otavio Salvador
2012-09-25 16:54 ` Marek Vasut
2012-09-25 20:17 ` Wolfgang Denk
2012-09-25 20:25 ` Marek Vasut
2012-09-29 1:34 ` [U-Boot] [PATCH 0/5 V2] Linker-generated arrays Marek Vasut
2012-09-29 1:34 ` [U-Boot] [PATCH 1/5] common: Add symbol handling for generic lists into Makefile Marek Vasut
2012-09-29 2:29 ` [U-Boot] [PATCH 1/5 V2] " Marek Vasut
2012-09-29 1:35 ` [U-Boot] [PATCH 2/5] common: Implement support for linker-generated arrays Marek Vasut
2012-09-29 1:35 ` [U-Boot] [PATCH 3/5] common: Add .u_boot_list into all linker files Marek Vasut
2012-09-29 1:35 ` [U-Boot] [PATCH 4/5] common: Convert the U-Boot commands to LG-arrays Marek Vasut
2012-09-29 1:35 ` [U-Boot] [PATCH 5/5] common: Discard the __u_boot_cmd section Marek Vasut
2012-09-29 2:44 ` [U-Boot] [PATCH 0/5 V2] Linker-generated arrays Marek Vasut
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201209241804.25793.marex@denx.de \
--to=marex@denx.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox