[PATCH] powerpc: put the gpr sabe/restore functions in their own section

Subsystems: linux for powerpc (32-bit and 64-bit), the rest

STALE5173d

3 messages, 2 authors, 2012-07-08 · open the first message on its own page

[PATCH] powerpc: put the gpr sabe/restore functions in their own section

From: Stephen Rothwell <hidden>
Date: 2012-07-06 07:09:46

This allows the linker to know that calls to them do not need to switch
TOC and stop errors like the following when linking large configurations:

powerpc64-linux-ld: drivers/built-in.o: In function `.gpiochip_is_requested':
(.text+0x4): sibling call optimization to `_savegpr0_29' does not allow automatic multiple TOCs; recompile with -mminimal-toc or -fno-optimize-sibling-calls, or make `_savegpr0_29' extern

Signed-off-by: Stephen Rothwell <redacted>
---
 arch/powerpc/lib/crtsavres.S |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
index 1c893f0..b2c68ce 100644
--- a/arch/powerpc/lib/crtsavres.S
+++ b/arch/powerpc/lib/crtsavres.S
@@ -41,12 +41,13 @@
 #include <asm/ppc_asm.h>
 
 	.file	"crtsavres.S"
-	.section ".text"
 
 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 
 #ifndef CONFIG_PPC64
 
+	.section ".text"
+
 /* Routines for saving integer registers, called by the compiler.  */
 /* Called with r11 pointing to the stack header word of the caller of the */
 /* function, just beyond the end of the integer save area.  */
@@ -232,6 +233,8 @@ _GLOBAL(_rest32gpr_31_x)
 
 #else /* CONFIG_PPC64 */
 
+	.section ".text.save.restore","ax",@progbits
+
 .globl	_savegpr0_14
 _savegpr0_14:
 	std	r14,-144(r1)
-- 
1.7.10.280.gaa39

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

Re: [PATCH] powerpc: put the gpr sabe/restore functions in their own section

From: Michael Ellerman <hidden>
Date: 2012-07-07 06:55:21

On Fri, 2012-07-06 at 17:09 +1000, Stephen Rothwell wrote:
This allows the linker to know that calls to them do not need to switch
TOC and stop errors like the following when linking large configurations:
 arch/powerpc/lib/crtsavres.S |    5 ++++-
You didn't make any change to the linker script? How does this section
get in there? I don't see a .text* anywhere?
quoted hunk
diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
index 1c893f0..b2c68ce 100644
--- a/arch/powerpc/lib/crtsavres.S
+++ b/arch/powerpc/lib/crtsavres.S
@@ -41,12 +41,13 @@
 #include <asm/ppc_asm.h>
 
 	.file	"crtsavres.S"
-	.section ".text"
 
 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 
 #ifndef CONFIG_PPC64
 
+	.section ".text"
+
 /* Routines for saving integer registers, called by the compiler.  */
 /* Called with r11 pointing to the stack header word of the caller of the */
 /* function, just beyond the end of the integer save area.  */
@@ -232,6 +233,8 @@ _GLOBAL(_rest32gpr_31_x)
 
 #else /* CONFIG_PPC64 */
 
+	.section ".text.save.restore","ax",@progbits
+
 .globl	_savegpr0_14
 _savegpr0_14:
 	std	r14,-144(r1)
Any reason to not put the 32-bit versions in the same section? AFAICS
nothing in that file uses the TOC. 

cheers

Re: [PATCH] powerpc: put the gpr sabe/restore functions in their own section

From: Stephen Rothwell <hidden>
Date: 2012-07-08 23:50:45

Hi Michael,

On Sat, 07 Jul 2012 16:55:21 +1000 Michael Ellerman [off-list ref] wrote:
On Fri, 2012-07-06 at 17:09 +1000, Stephen Rothwell wrote:
quoted
This allows the linker to know that calls to them do not need to switch
TOC and stop errors like the following when linking large configurations:
quoted
 arch/powerpc/lib/crtsavres.S |    5 ++++-
You didn't make any change to the linker script? How does this section
get in there? I don't see a .text* anywhere?
Yeah.  ld just seems to figure it out (I note that we also have sections
called .text.unlikely and .text.startup).
quoted
diff --git a/arch/powerpc/lib/crtsavres.S b/arch/powerpc/lib/crtsavres.S
index 1c893f0..b2c68ce 100644
--- a/arch/powerpc/lib/crtsavres.S
+++ b/arch/powerpc/lib/crtsavres.S
@@ -41,12 +41,13 @@
 #include <asm/ppc_asm.h>
 
 	.file	"crtsavres.S"
-	.section ".text"
 
 #ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
 
 #ifndef CONFIG_PPC64
 
+	.section ".text"
+
 /* Routines for saving integer registers, called by the compiler.  */
 /* Called with r11 pointing to the stack header word of the caller of the */
 /* function, just beyond the end of the integer save area.  */
@@ -232,6 +233,8 @@ _GLOBAL(_rest32gpr_31_x)
 
 #else /* CONFIG_PPC64 */
 
+	.section ".text.save.restore","ax",@progbits
+
 .globl	_savegpr0_14
 _savegpr0_14:
 	std	r14,-144(r1)
Any reason to not put the 32-bit versions in the same section? AFAICS
nothing in that file uses the TOC. 
32 bit does not use a toc (apparently).  And I figured to make the
minimal change to the output.

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help