linux-sh.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] sh: mcount.S: fix build error when PRINTK is not enabled
@ 2021-11-15  6:41 Randy Dunlap
  2021-11-15 10:10 ` Geert Uytterhoeven
  0 siblings, 1 reply; 3+ messages in thread
From: Randy Dunlap @ 2021-11-15  6:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: Randy Dunlap, Yoshinori Sato, Rich Felker, linux-sh, Paul Mundt

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.")
Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: Rich Felker <dalias@libc.org>
Cc: linux-sh@vger.kernel.org
Cc: Paul Mundt <lethal@linux-sh.org>
---
Possibly even more of this function should conditionally not be built...

 arch/sh/lib/mcount.S |    4 ++++
 1 file changed, 4 insertions(+)

--- linux-next-20211112.orig/arch/sh/lib/mcount.S
+++ linux-next-20211112/arch/sh/lib/mcount.S
@@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] sh: mcount.S: fix build error when PRINTK is not enabled
  2021-11-15  6:41 [PATCH 1/2] sh: mcount.S: fix build error when PRINTK is not enabled Randy Dunlap
@ 2021-11-15 10:10 ` Geert Uytterhoeven
  2021-11-16  2:48   ` Randy Dunlap
  0 siblings, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2021-11-15 10:10 UTC (permalink / raw)
  To: Randy Dunlap
  Cc: Linux Kernel Mailing List, Yoshinori Sato, Rich Felker,
	Linux-sh list, Paul Mundt

Hi Randy,

On Mon, Nov 15, 2021 at 7:41 AM Randy Dunlap <rdunlap@infradead.org> wrote:
> 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.")
> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>

Thanks for your patch!

> 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...

> --- linux-next-20211112.orig/arch/sh/lib/mcount.S
> +++ linux-next-20211112/arch/sh/lib/mcount.S
> @@ -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

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/2] sh: mcount.S: fix build error when PRINTK is not enabled
  2021-11-15 10:10 ` Geert Uytterhoeven
@ 2021-11-16  2:48   ` Randy Dunlap
  0 siblings, 0 replies; 3+ messages in thread
From: Randy Dunlap @ 2021-11-16  2:48 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Linux Kernel Mailing List, Yoshinori Sato, Rich Felker,
	Linux-sh list, Paul Mundt

On 11/15/21 2:10 AM, Geert Uytterhoeven wrote:
> Hi Randy,
> 
> On Mon, Nov 15, 2021 at 7:41 AM Randy Dunlap <rdunlap@infradead.org> wrote:
>> 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.")
>> Signed-off-by: Randy Dunlap <rdunlap@infradead.org>
> 
> Thanks for your patch!
> 
>> 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.
-- 
~Randy

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-16  5:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-15  6:41 [PATCH 1/2] sh: mcount.S: fix build error when PRINTK is not enabled Randy Dunlap
2021-11-15 10:10 ` Geert Uytterhoeven
2021-11-16  2:48   ` Randy Dunlap

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).