Skip to content

Commit 518f76f

Browse files
nathanchanceSasha Levin
authored and
Sasha Levin
committed
modpost: Include '.text.*' in TEXT_SECTIONS
commit 19331e8 upstream. Commit 6c730bf ("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/[email protected]/ Reported-by: Vincent Donnefort <[email protected]> Reviewed-and-tested-by: Alexander Lobakin <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Tested-by: Vincent Donnefort <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Nathan Chancellor <[email protected]> Stable-dep-of: 846cfbe ("um: Fix adding '-no-pie' for clang") Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3ca3d7b commit 518f76f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scripts/mod/modpost.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -824,10 +824,10 @@ static void check_section(const char *modname, struct elf_info *elf,
824824
#define ALL_EXIT_SECTIONS EXIT_SECTIONS
825825

826826
#define DATA_SECTIONS ".data", ".data.rel"
827-
#define TEXT_SECTIONS ".text", ".text.unlikely", ".sched.text", \
827+
#define TEXT_SECTIONS ".text", ".text.*", ".sched.text", \
828828
".kprobes.text", ".cpuidle.text", ".noinstr.text"
829829
#define OTHER_TEXT_SECTIONS ".ref.text", ".head.text", ".spinlock.text", \
830-
".fixup", ".entry.text", ".exception.text", ".text.*", \
830+
".fixup", ".entry.text", ".exception.text", \
831831
".coldtext", ".softirqentry.text"
832832

833833
#define INIT_SECTIONS ".init.*"

0 commit comments

Comments
 (0)