[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240313164223.615640-45-sashal@kernel.org>
Date: Wed, 13 Mar 2024 12:41:51 -0400
From: Sasha Levin <sashal@...nel.org>
To: linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Nathan Chancellor <nathan@...nel.org>,
Vincent Donnefort <vdonnefort@...gle.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Sami Tolvanen <samitolvanen@...gle.com>,
Masahiro Yamada <masahiroy@...nel.org>,
Sasha Levin <sashal@...nel.org>
Subject: [PATCH 5.15 44/76] modpost: Include '.text.*' in TEXT_SECTIONS
From: Nathan Chancellor <nathan@...nel.org>
[ Upstream commit 19331e84c3873256537d446afec1f6c507f8c4ef ]
Commit 6c730bfc894f ("modpost: handle -ffunction-sections") added
".text.*" to the OTHER_TEXT_SECTIONS macro to fix certain section
mismatch warnings. Unfortunately, this makes it impossible for modpost
to warn about section mismatches with LTO, which implies
'-ffunction-sections', as all functions are put in their own
'.text.<func_name>' sections, which may still reference functions in
sections they are not supposed to, such as __init.
Fix this by moving ".text.*" into TEXT_SECTIONS, so that configurations
with '-ffunction-sections' will see warnings about mismatched sections.
Link: https://lore.kernel.org/Y39kI3MOtVI5BAnV@google.com/
Reported-by: Vincent Donnefort <vdonnefort@...gle.com>
Reviewed-and-tested-by: Alexander Lobakin <alexandr.lobakin@...el.com>
Reviewed-by: Sami Tolvanen <samitolvanen@...gle.com>
Tested-by: Vincent Donnefort <vdonnefort@...gle.com>
Signed-off-by: Nathan Chancellor <nathan@...nel.org>
Signed-off-by: Masahiro Yamada <masahiroy@...nel.org>
Stable-dep-of: 397586506c3d ("modpost: Add '.ltext' and '.ltext.*' to TEXT_SECTIONS")
Signed-off-by: Sasha Levin <sashal@...nel.org>
---
scripts/mod/modpost.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c6e655e0ed988..43bacdee5cc5d 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -936,10 +936,10 @@ static void check_section(const char *modname, struct elf_info *elf,
#define ALL_EXIT_SECTIONS EXIT_SECTIONS, ALL_XXXEXIT_SECTIONS
#define DATA_SECTIONS ".data", ".data.rel"
-#define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \
+#define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \
".kprobes.text", ".cpuidle.text", ".noinstr.text"
#define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \
- ".fixup", ".entry.text", ".exception.text", ".text.*", \
+ ".fixup", ".entry.text", ".exception.text", \
".coldtext", ".softirqentry.text"
#define INIT_SECTIONS ".init.*"
--
2.43.0
Powered by blists - more mailing lists