Re: linux-next: build failure after merge of the kgdb tree

From: Doug Anderson
Date: Tue May 19 2020 - 10:59:08 EST


Hi,

On Tue, May 19, 2020 at 7:05 AM Stephen Rothwell <sfr@xxxxxxxxxxxxxxxx> wrote:
>
> Hi all,
>
> After merging the kgdb tree, today's linux-next build (x86_64
> allmodconfig) failed like this:
>
> drivers/tty/serial/kgdboc.c:418:13: error: expected declaration specifiers or '...' before string constant
> 418 | early_param("ekgdboc", kgdboc_early_init);
> | ^~~~~~~~~
> drivers/tty/serial/kgdboc.c:418:24: error: expected declaration specifiers or '...' before 'kgdboc_early_init'
> 418 | early_param("ekgdboc", kgdboc_early_init);
> | ^~~~~~~~~~~~~~~~~
> drivers/tty/serial/kgdboc.c:546:13: error: expected declaration specifiers or '...' before string constant
> 546 | early_param("kgdboc_earlycon", kgdboc_earlycon_init);
> | ^~~~~~~~~~~~~~~~~
> drivers/tty/serial/kgdboc.c:546:32: error: expected declaration specifiers or '...' before 'kgdboc_earlycon_init'
> 546 | early_param("kgdboc_earlycon", kgdboc_earlycon_init);
> | ^~~~~~~~~~~~~~~~~~~~
> drivers/tty/serial/kgdboc.c:505:19: warning: 'kgdboc_earlycon_init' defined but not used [-Wunused-function]
> 505 | static int __init kgdboc_earlycon_init(char *opt)
> | ^~~~~~~~~~~~~~~~~~~~
> drivers/tty/serial/kgdboc.c:411:19: warning: 'kgdboc_early_init' defined but not used [-Wunused-function]
> 411 | static int __init kgdboc_early_init(char *opt)
> | ^~~~~~~~~~~~~~~~~
>
> Caused by commit
>
> 220995622da5 ("kgdboc: Add kgdboc_earlycon to support early kgdb using boot consoles")
>
> I have used the kgdb tree from next-20200518 for today.

Ugh. Actually, I think the commit to blame is:

eae3e19ca930 ("kgdboc: Remove useless #ifdef
CONFIG_KGDB_SERIAL_CONSOLE in kgdboc")

The next commit just made it worse. Apparently the #ifdef wasn't so
useless after all. It was just subtly keeping the code from compiling
when kgdboc was used as a module. That's because when it's a module
we instead get this defined:

#define CONFIG_KGDB_SERIAL_CONSOLE_MODULE 1

Apparently I didn't re-test as a module after I made this change in
one of the later spins. :(

I think I can whip up a quick patch that uses "IS_BUILTIN(option)".
Basically this should go back to how the code was in one of the
earlier patchsets where I tested this.

-Doug