xen: arm: include .text.cold and .text.unlikely in text area
PATCH 1/1 xen: arm: include .text.cold and .text.unlikely in text area
Otherwise functions in these sections can end up between .text and .rodata which is after _etext and therefore gets made non-executable.
This matches x86 (although it was done there for different reasons).
---
Jan, any reason why x86 doesn't just use .text.*?
--- xen/arch/arm/xen.lds.S | 2 ++ 1 file changed, 2 insertions(+)
xen/arch/arm/xen.lds.S +2 -0
@@ -30,6 +30,8 @@ SECTIONS .text : /* XXX should be AT ( XEN_PHYS_START ) */ { _stext = .; /* Text section */ *(.text) + *(.text.cold) + *(.text.unlikely) *(.fixup) *(.gnu.warning) _etext = .; /* End of text section */
Signature · 1 line
1.7.10.4
Hi Ian,
Quoted 7 lines · Ian Campbell
Otherwise functions in these sections can end up between .text and .rodata which is after
_etextand therefore gets made non-executable.This matches x86 (although it was done there for different reasons).
Signed-off-by Ian Campbell <[email protected]>Cc Jan Beulich <[email protected]>
Regards,
Signature · 1 line
Julien Grall
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 09.06.14 at 16:28, <[email protected]> wrote:
Otherwise functions in these sections can end up between .text and .rodata which is after
_etextand therefore gets made non-executable.This matches x86 (although it was done there for different reasons).
Signed-off-by Ian Campbell <[email protected]>Cc Jan Beulich <[email protected]>---
Jan, any reason why x86 doesn't just use .text.*?
Because we want the .cold and .unlikely all adjacent, rather than intermixed with eventual other ones (imagine mixing in a hypothetical .text.hot).
Jan
Quoted 19 lines
--- xen/arch/arm/xen.lds.S | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/xen.lds.S +2
-0@@ -30,6 +30,8 @@ SECTIONS .text : /* XXX should be AT ( XEN_PHYS_START ) */ { _stext = .; /* Text section */ *(.text) + *(.text.cold) + *(.text.unlikely) *(.fixup) *(.gnu.warning) _etext = .; /* End of text section */Signature · 1 line
1.7.10.4
Quoted 6 lines · Jan Beulich
Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 09.06.14 at 16:28, <[email protected]> wrote:
Otherwise functions in these sections can end up between .text and .rodata which is after
_etextand therefore gets made non-executable.This matches x86 (although it was done there for different reasons).
Quoted 8 lines
Quoted 4 lines
Signed-off-by Ian Campbell <[email protected]>Cc Jan Beulich <[email protected]>---
Jan, any reason why x86 doesn't just use .text.*?Because we want the .cold and .unlikely all adjacent, rather than intermixed with eventual other ones (imagine mixing in a hypothetical .text.hot).
That makes sense. Could we specify .text.* after those as a fallback or would we rather deal with each new section specifically so we can have a think about the right location?
I don't suppose there is a linker option to make it barf on non-explicitly placed sections, is there? That would have turned this silent (and hard to diagnose) failure into something more explicit.
Ian.
Quoted 25 lines
Jan
Quoted 19 lines
--- xen/arch/arm/xen.lds.S | 2 ++ 1 file changed, 2 insertions(+)xen/arch/arm/xen.lds.S +2
-0@@ -30,6 +30,8 @@ SECTIONS .text : /* XXX should be AT ( XEN_PHYS_START ) */ { _stext = .; /* Text section */ *(.text) + *(.text.cold) + *(.text.unlikely) *(.fixup) *(.gnu.warning) _etext = .; /* End of text section */Signature · 1 line
1.7.10.4
Quoted 13 lines
Quoted 1 line
Quoted 1 line · On 10.06.14 at 11:07, <[email protected]> wrote:
Quoted 11 lines · Jan Beulich
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 09.06.14 at 16:28, <[email protected]> wrote:
Otherwise functions in these sections can end up between .text and .rodata which is after
_etextand therefore gets made non-executable.This matches x86 (although it was done there for different reasons).
Signed-off-by Ian Campbell <[email protected]>Cc Jan Beulich <[email protected]>---
Jan, any reason why x86 doesn't just use .text.*?
Quoted 7 lines
Quoted 3 lines
Because we want the .cold and .unlikely all adjacent, rather than intermixed with eventual other ones (imagine mixing in a hypothetical .text.hot).
That makes sense. Could we specify .text.* after those as a fallback or would we rather deal with each new section specifically so we can have a think about the right location?
That's certainly an option - placing them inefficiently is clearly better than placing them wrongly.
Quoted 3 lines
I don't suppose there is a linker option to make it barf on non-explicitly placed sections, is there? That would have turned this silent (and hard to diagnose) failure into something more explicit.
I'm not aware of any such option.
Jan
Ian Campbell
AppliedQuoted 6 lines · Julien Grall
Hi Ian,
Quoted 3 lines · Ian Campbell
Otherwise functions in these sections can end up between .text and .rodata which is after
_etextand therefore gets made non-executable.
Quoted 6 lines
Quoted 4 lines
This matches x86 (although it was done there for different reasons).
Signed-off-by Ian Campbell <[email protected]>Cc Jan Beulich <[email protected]>Acked-by Julien Grall <[email protected]>
Applied, thanks.
Ian.