Skip to contentSkip to conversation

sh: mcount.S: fix build error when PRINTK is not enabled

PATCH Superseded Randy Dunlap 2 participants 3 messages Nov 15, 2021 – Nov 16, 2021 SuperH

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 sh: mcount.S: fix build error when PRINTK is not enabled

Fix a build error in mcount.S when CONFIG_PRINTK is not enabled. Fixes this build error:

sh2-linux-ld: arch/sh/lib/mcount.o: in function `stack_panic':
(.text+0xec): undefined reference to `dump_stack'

Fixes e460ab27b6c3e ("sh: Fix up stack overflow check with ftrace disabled.")
Cc Yoshinori Sato <[email protected]>
Cc Rich Felker <[email protected]>
Cc Paul Mundt <[email protected]>

---
Possibly even more of this function should conditionally not be built...

 arch/sh/lib/mcount.S |    4 ++++
 1 file changed, 4 insertions(+)
arch/sh/lib/mcount.S +4 -0
@@ -257,9 +257,11 @@ return_to_handler:
 #ifdef CONFIG_STACK_DEBUG
 	.globl	stack_panic
 stack_panic:
+#ifdef CONFIG_PRINTK
 	mov.l	.Ldump_stack, r0
 	jsr	@r0
 	 nop
+#endif
 
 	mov.l	.Lpanic, r0
 	jsr	@r0
@@ -277,8 +279,10 @@ stack_panic:
 	.long	panic
 .Lpanic_s:
 	.long	.Lpanic_str
+#ifdef CONFIG_PRINTK
 .Ldump_stack:
 	.long	dump_stack
+#endif
 
 	.section	.rodata
 	.align 2
#1 lore raw

Hi Randy,

Quoted 8 lines · Randy Dunlap

Fix a build error in mcount.S when CONFIG_PRINTK is not enabled. Fixes this build error:

sh2-linux-ld: arch/sh/lib/mcount.o: in function `stack_panic':
(.text+0xec): undefined reference to `dump_stack'

Fixes e460ab27b6c3e ("sh: Fix up stack overflow check with ftrace disabled.")

Thanks for your patch!

Quoted 1 line

Possibly even more of this function should conditionally not be built...

What about making STACK_DEBUG depend on PRINTK instead? It doesn't make much sense to enable the former, if you won't print any output...

Quoted 15 lines
arch/sh/lib/mcount.S +2 -0
@@ -257,9 +257,11 @@ return_to_handler:
 #ifdef CONFIG_STACK_DEBUG
        .globl  stack_panic
 stack_panic:
+#ifdef CONFIG_PRINTK
        mov.l   .Ldump_stack, r0
        jsr     @r0
         nop
+#endif
 
        mov.l   .Lpanic, r0
        jsr     @r0

arch/sh/lib/mcount.S stack_panic: · line 288

Quoted 10 lines
arch/sh/lib/mcount.S +2 -0
@@ -277,8 +279,10 @@ stack_panic:
        .long   panic
 .Lpanic_s:
        .long   .Lpanic_str
+#ifdef CONFIG_PRINTK
 .Ldump_stack:
        .long   dump_stack
+#endif
 
        .section        .rodata
        .align 2

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#2 lore raw
Quoted 12 lines · Geert Uytterhoeven

Hi Randy,

Quoted 8 lines · Randy Dunlap

Fix a build error in mcount.S when CONFIG_PRINTK is not enabled. Fixes this build error:

sh2-linux-ld: arch/sh/lib/mcount.o: in function `stack_panic':
(.text+0xec): undefined reference to `dump_stack'

Fixes e460ab27b6c3e ("sh: Fix up stack overflow check with ftrace disabled.")
Quoted 7 lines

Thanks for your patch!

Quoted 1 line

Possibly even more of this function should conditionally not be built...

What about making STACK_DEBUG depend on PRINTK instead? It doesn't make much sense to enable the former, if you won't print any output...

Hi Geert,
That works. Thanks for the suggestion.

I'll send a v2.

Signature · 1 line
~Randy