Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: keep .modinfo section in vmlinux.unstripped

Keep the .modinfo section during linking, but strip it from the final
vmlinux.

Adjust scripts/mksysmap to exclude modinfo symbols from kallsyms.

This change will allow the next commit to extract the .modinfo section
from the vmlinux.unstripped intermediate.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Alexey Gladkov <legion@kernel.org>
Reviewed-by: Nicolas Schier <nsc@kernel.org>
Link: https://patch.msgid.link/aaf67c07447215463300fccaa758904bac42f992.1758182101.git.legion@kernel.org
Signed-off-by: Nathan Chancellor <nathan@kernel.org>

authored by

Masahiro Yamada and committed by
Nathan Chancellor
3e86e4d7 0ce5139f

+9 -3
+1 -1
include/asm-generic/vmlinux.lds.h
··· 831 831 832 832 /* Required sections not related to debugging. */ 833 833 #define ELF_DETAILS \ 834 + .modinfo : { *(.modinfo) } \ 834 835 .comment 0 : { *(.comment) } \ 835 836 .symtab 0 : { *(.symtab) } \ 836 837 .strtab 0 : { *(.strtab) } \ ··· 1045 1044 *(.discard.*) \ 1046 1045 *(.export_symbol) \ 1047 1046 *(.no_trim_symbol) \ 1048 - *(.modinfo) \ 1049 1047 /* ld.bfd warns about .gnu.version* even when not emitted */ \ 1050 1048 *(.gnu.version*) \ 1051 1049
+5 -2
scripts/Makefile.vmlinux
··· 86 86 # vmlinux 87 87 # --------------------------------------------------------------------------- 88 88 89 - remove-section-y := 89 + remove-section-y := .modinfo 90 90 remove-section-$(CONFIG_ARCH_VMLINUX_NEEDS_RELOCS) += '.rel*' 91 91 92 + # To avoid warnings: "empty loadable segment detected at ..." from GNU objcopy, 93 + # it is necessary to remove the PT_LOAD flag from the segment. 92 94 quiet_cmd_strip_relocs = OBJCOPY $@ 93 - cmd_strip_relocs = $(OBJCOPY) $(addprefix --remove-section=,$(remove-section-y)) $< $@ 95 + cmd_strip_relocs = $(OBJCOPY) $(patsubst %,--set-section-flags %=noload,$(remove-section-y)) $< $@; \ 96 + $(OBJCOPY) $(addprefix --remove-section=,$(remove-section-y)) $@ 94 97 95 98 targets += vmlinux 96 99 vmlinux: vmlinux.unstripped FORCE
+3
scripts/mksysmap
··· 79 79 / _SDA_BASE_$/d 80 80 / _SDA2_BASE_$/d 81 81 82 + # MODULE_INFO() 83 + / __UNIQUE_ID_modinfo[0-9]*$/d 84 + 82 85 # --------------------------------------------------------------------------- 83 86 # Ignored patterns 84 87 # (symbols that contain the pattern are ignored)