[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230419-mips-check_bugs-init-attribute-v2-1-60a7ee65d4bf@kernel.org>
Date: Fri, 21 Apr 2023 09:11:26 -0700
From: Nathan Chancellor <nathan@...nel.org>
To: tsbogend@...ha.franken.de
Cc: ndesaulniers@...gle.com, linux-mips@...r.kernel.org,
linux-kernel@...r.kernel.org, llvm@...ts.linux.dev,
patches@...ts.linux.dev,
Naresh Kamboju <naresh.kamboju@...aro.org>,
Nathan Chancellor <nathan@...nel.org>
Subject: [PATCH v2 1/2] MIPS: Mark check_bugs() as __init
After commit ac7c3e4ff401 ("compiler: enable CONFIG_OPTIMIZE_INLINING
forcibly"), a compiler may choose not to inline a function marked with
just 'inline'. If check_bugs() is not inlined into start_kernel(), which
occurs when building with clang after commit 9ea7e6b62c2b ("init: Mark
[arch_call_]rest_init() __noreturn"), modpost complains with:
WARNING: modpost: vmlinux.o: section mismatch in reference: check_bugs (section: .text) -> check_bugs32 (section: .init.text)
check_bugs() is only called from start_kernel(), which itself is marked
__init, so there would not be any issues at run time. Make it obvious to
modpost that this call chain is safe by marking check_bugs() as __init,
which fixes the warning.
Reported-by: Naresh Kamboju <naresh.kamboju@...aro.org>
Link: https://lore.kernel.org/CA+G9fYt+4e57Gdy6cix=LeNK6XqWoui8du=mZWu=cf8vPYocKw@mail.gmail.com/
Signed-off-by: Nathan Chancellor <nathan@...nel.org>
---
arch/mips/include/asm/bugs.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/mips/include/asm/bugs.h b/arch/mips/include/asm/bugs.h
index d72dc6e1cf3c..047e14227c45 100644
--- a/arch/mips/include/asm/bugs.h
+++ b/arch/mips/include/asm/bugs.h
@@ -30,7 +30,7 @@ static inline void check_bugs_early(void)
check_bugs64_early();
}
-static inline void check_bugs(void)
+static inline void __init check_bugs(void)
{
unsigned int cpu = smp_processor_id();
--
2.40.0
Powered by blists - more mailing lists