[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20210120180410.taayippxf2wdrvpx@treble>
Date: Wed, 20 Jan 2021 12:04:10 -0600
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Sam Ravnborg <sam@...nborg.org>
Cc: linux-kernel@...r.kernel.org, Peter Zijlstra <peterz@...radead.org>
Subject: Question about CONFIG_DEBUG_SECTION_MISMATCH
Hi Sam,
I have a question about CONFIG_DEBUG_SECTION_MISMATCH's use of
-fno-inline-functions-called-once.
- Add the option -fno-inline-functions-called-once to gcc commands.
When inlining a function annotated with __init in a non-init
function, we would lose the section information and thus
the analysis would not catch the illegal reference.
This option tells gcc to inline less (but it does result in
a larger kernel).
Is -fno-inline-functions-called-once really needed?
>From what I can tell, a .text function inlining an .init.text function
should be harmless unless the inlined function either referenced another
.init.text function, or referenced .init.data. In either case, that
would be detected by modpost.
Or am I missing another scenario where this flag would be needed?
I verified this with the following patch, it detected a mismatch even
without CONFIG_DEBUG_SECTION_MISMATCH.
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 6bd20c0de8bc..c3e41a3abc7e 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -153,6 +153,18 @@ static inline void imcr_apic_to_pic(void)
*/
static int force_enable_local_apic __initdata;
+static int __init foo(void)
+{
+ if (force_enable_local_apic)
+ return 1;
+ return 0;
+}
+
+int bar(void)
+{
+ return foo();
+}
+
/*
* APIC command line parameters
*/
--
Josh
Powered by blists - more mailing lists