* [PATCH v3] xtensa: improve vmlinux.lds.S sed post-processing
@ 2015-08-21 17:43 Max Filippov
2015-08-21 18:22 ` Chris Zankel
0 siblings, 1 reply; 2+ messages in thread
From: Max Filippov @ 2015-08-21 17:43 UTC (permalink / raw)
To: linux-xtensa
Cc: Chris Zankel, Marc Gauthier, Guenter Roeck, LKML, Max Filippov
Current sed script makes assumptions about the structure of rules that
group .text sections in the vmlinux linker script. These assumptions
get broken occasionally, e.g.: 779c88c94c34 "ARM: 8321/1: asm-generic:
introduce.text.fixup input section", or 9bebe9e5b0f3 "kbuild: Fix
.text.unlikely placement".
Rewrite sed rules so that they don't depend on number/arrangement of text
sections in *(...) blocks.
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
This fixes breakage in the linux-next. Chris, could you please apply it to
your for_next branch?
Changes v2 -> v3:
- rebase to the current master
Changes v1 -> v2:
- don't change arbitrary sections containing .text, only .text, .ref.text
and .[a-z]*it.text
arch/xtensa/kernel/Makefile | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index d3a0f0f..ad93217 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -27,10 +27,11 @@ AFLAGS_head.o += -mtext-section-literals
#
# Replicate rules in scripts/Makefile.build
-sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \
- -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \
- -e 's/\*(\(\.text .*\))/*(.literal \1)/g' \
- -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g'
+sed-y = -e ':a; s/\*(\([^)]*\)\.text\.unlikely/*(\1.literal.unlikely .{text}.unlikely/; ta; ' \
+ -e ':b; s/\*(\([^)]*\)\.text\(\.[a-z]*\)/*(\1.{text}\2.literal .{text}\2/; tb; ' \
+ -e ':c; s/\*(\([^)]*\)\(\.[a-z]*it\|\.ref\)\.text/*(\1\2.literal \2.{text}/; tc; ' \
+ -e ':d; s/\*(\([^)]\+ \|\)\.text/*(\1.literal .{text}/; td; ' \
+ -e 's/\.{text}/.text/g'
quiet_cmd__cpp_lds_S = LDS $@
cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
--
1.8.1.4
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v3] xtensa: improve vmlinux.lds.S sed post-processing
2015-08-21 17:43 [PATCH v3] xtensa: improve vmlinux.lds.S sed post-processing Max Filippov
@ 2015-08-21 18:22 ` Chris Zankel
0 siblings, 0 replies; 2+ messages in thread
From: Chris Zankel @ 2015-08-21 18:22 UTC (permalink / raw)
To: Max Filippov; +Cc: linux-xtensa, Marc Gauthier, Guenter Roeck, LKML
Thanks Max. Running a test build and will add to xtensa-next.
On Fri, Aug 21, 2015 at 10:43 AM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> Current sed script makes assumptions about the structure of rules that
> group .text sections in the vmlinux linker script. These assumptions
> get broken occasionally, e.g.: 779c88c94c34 "ARM: 8321/1: asm-generic:
> introduce.text.fixup input section", or 9bebe9e5b0f3 "kbuild: Fix
> .text.unlikely placement".
>
> Rewrite sed rules so that they don't depend on number/arrangement of text
> sections in *(...) blocks.
>
> Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
> ---
> This fixes breakage in the linux-next. Chris, could you please apply it to
> your for_next branch?
>
> Changes v2 -> v3:
> - rebase to the current master
>
> Changes v1 -> v2:
> - don't change arbitrary sections containing .text, only .text, .ref.text
> and .[a-z]*it.text
>
> arch/xtensa/kernel/Makefile | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
> index d3a0f0f..ad93217 100644
> --- a/arch/xtensa/kernel/Makefile
> +++ b/arch/xtensa/kernel/Makefile
> @@ -27,10 +27,11 @@ AFLAGS_head.o += -mtext-section-literals
> #
> # Replicate rules in scripts/Makefile.build
>
> -sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \
> - -e 's/\.text\.unlikely/.literal.unlikely .text.unlikely/g' \
> - -e 's/\*(\(\.text .*\))/*(.literal \1)/g' \
> - -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g'
> +sed-y = -e ':a; s/\*(\([^)]*\)\.text\.unlikely/*(\1.literal.unlikely .{text}.unlikely/; ta; ' \
> + -e ':b; s/\*(\([^)]*\)\.text\(\.[a-z]*\)/*(\1.{text}\2.literal .{text}\2/; tb; ' \
> + -e ':c; s/\*(\([^)]*\)\(\.[a-z]*it\|\.ref\)\.text/*(\1\2.literal \2.{text}/; tc; ' \
> + -e ':d; s/\*(\([^)]\+ \|\)\.text/*(\1.literal .{text}/; td; ' \
> + -e 's/\.{text}/.text/g'
>
> quiet_cmd__cpp_lds_S = LDS $@
> cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
> --
> 1.8.1.4
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-21 18:23 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-21 17:43 [PATCH v3] xtensa: improve vmlinux.lds.S sed post-processing Max Filippov
2015-08-21 18:22 ` Chris Zankel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®