From: Safocl Stollmannovic <safocl88@gmail.com>
To: Petr Mladek <pmladek@suse.com>,
John Ogness <john.ogness@linutronix.de>,
Steven Rostedt <rostedt@goodmis.org>,
Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: linux-kernel@vger.kernel.org, printk@lists.linux.dev
Subject: [PATCH v3 11/14] printk: fix duplicate extern declarations
Date: Sat, 14 Nov 2026 20:55:51 +0400 [thread overview]
Message-ID: <20261114165612.368785-12-safocl88@gmail.com> (raw)
In-Reply-To: <20261114165612.368785-1-safocl88@gmail.com>
Compiling a kernel module with a C++ compiler results in a "duplicate
extern specifier" error.
This occurs because the code contains `extern asmlinkage`, and `asmlinkage`
expands to `extern C` when processed by a C++ compiler.
Since the code already contains sections that respond to a C++ compiler,
I believe it is a perfectly valid approach to gradually move toward a state
where kernel modules can be compiled by a C++ compiler without any issues.
The `extern` specifier must be removed.
Link: https://bugzilla.kernel.org/show_bug.cgi?id=222257
Signed-off-by: Safocl Stollmannovic <safocl88@gmail.com>
---
include/linux/printk.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/include/linux/printk.h b/include/linux/printk.h
index f594c1266..09a28181e 100644
--- a/include/linux/printk.h
+++ b/include/linux/printk.h
@@ -136,7 +136,7 @@ struct va_format {
})
#ifdef CONFIG_EARLY_PRINTK
-extern asmlinkage __printf(1, 2)
+asmlinkage __printf(1, 2)
void early_printk(const char *fmt, ...);
#else
static inline __printf(1, 2) __cold
@@ -200,8 +200,8 @@ void __init setup_log_buf(int early);
__printf(1, 2) void dump_stack_set_arch_desc(const char *fmt, ...);
void dump_stack_print_info(const char *log_lvl);
void show_regs_print_info(const char *log_lvl);
-extern asmlinkage void dump_stack_lvl(const char *log_lvl) __cold;
-extern asmlinkage void dump_stack(void) __cold;
+asmlinkage void dump_stack_lvl(const char *log_lvl) __cold;
+asmlinkage void dump_stack(void) __cold;
void printk_trigger_flush(void);
void console_try_replay_all(void);
void printk_legacy_allow_panic_sync(void);
--
2.56.1
next prev parent reply other threads:[~2026-11-14 16:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 16:55 [PATCH v3 00/14] Remove redundant " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 01/14] ARM: fix duplicate " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 02/14] loongarch: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 03/14] microblaze: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 04/14] MIPS: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 05/14] openrisc: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 06/14] riscv: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 07/14] x86: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 08/14] drivers: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 09/14] sched/preempt: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 10/14] lockdep: " Safocl Stollmannovic
2026-11-14 16:55 ` Safocl Stollmannovic [this message]
2026-11-14 16:55 ` [PATCH v3 12/14] shed/task: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 13/14] start_kernel: " Safocl Stollmannovic
2026-11-14 16:55 ` [PATCH v3 14/14] suspend: " Safocl Stollmannovic
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261114165612.368785-12-safocl88@gmail.com \
--to=safocl88@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=printk@lists.linux.dev \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®