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: Add gendwarfksyms as an alternative to genksyms

When MODVERSIONS is enabled, allow selecting gendwarfksyms as the
implementation, but default to genksyms.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

authored by

Sami Tolvanen and committed by
Masahiro Yamada
9c3681f9 d7476f24

+52 -7
+22
kernel/module/Kconfig
··· 169 169 make them incompatible with the kernel you are running. If 170 170 unsure, say N. 171 171 172 + choice 173 + prompt "Module versioning implementation" 174 + depends on MODVERSIONS 175 + help 176 + Select the tool used to calculate symbol versions for modules. 177 + 178 + If unsure, select GENKSYMS. 179 + 180 + config GENKSYMS 181 + bool "genksyms (from source code)" 182 + help 183 + Calculate symbol versions from pre-processed source code using 184 + genksyms. 185 + 186 + If unsure, say Y. 187 + 172 188 config GENDWARFKSYMS 173 189 bool "gendwarfksyms (from debugging information)" 174 190 depends on DEBUG_INFO ··· 192 176 depends on !DEBUG_INFO_REDUCED && !DEBUG_INFO_SPLIT 193 177 # Requires ELF object files. 194 178 depends on !LTO 179 + help 180 + Calculate symbol versions from DWARF debugging information using 181 + gendwarfksyms. Requires DEBUG_INFO to be enabled. 182 + 183 + If unsure, say N. 184 + endchoice 195 185 196 186 config ASM_MODVERSIONS 197 187 bool
+1 -1
scripts/Makefile
··· 53 53 targets += module.lds 54 54 55 55 subdir-$(CONFIG_GCC_PLUGINS) += gcc-plugins 56 - subdir-$(CONFIG_MODVERSIONS) += genksyms 56 + subdir-$(CONFIG_GENKSYMS) += genksyms 57 57 subdir-$(CONFIG_GENDWARFKSYMS) += gendwarfksyms 58 58 subdir-$(CONFIG_SECURITY_SELINUX) += selinux 59 59 subdir-$(CONFIG_SECURITY_IPE) += ipe
+29 -6
scripts/Makefile.build
··· 107 107 $(obj)/%.i: $(obj)/%.c FORCE 108 108 $(call if_changed_dep,cpp_i_c) 109 109 110 + getexportsymbols = $(NM) $@ | sed -n 's/.* __export_symbol_\(.*\)/$(1)/p' 111 + 112 + gendwarfksyms = $(objtree)/scripts/gendwarfksyms/gendwarfksyms \ 113 + $(if $(KBUILD_SYMTYPES), --symtypes $(@:.o=.symtypes)) \ 114 + $(if $(KBUILD_GENDWARFKSYMS_STABLE), --stable) 115 + 110 116 genksyms = $(objtree)/scripts/genksyms/genksyms \ 111 117 $(if $(KBUILD_SYMTYPES), -T $(@:.o=.symtypes)) \ 112 118 $(if $(KBUILD_PRESERVE), -p) \ 113 119 $(addprefix -r , $(wildcard $(@:.o=.symref))) 114 120 115 121 # These mirror gensymtypes_S and co below, keep them in synch. 122 + ifdef CONFIG_GENDWARFKSYMS 123 + cmd_gensymtypes_c = $(if $(skip_gendwarfksyms),, \ 124 + $(call getexportsymbols,\1) | $(gendwarfksyms) $@) 125 + else 116 126 cmd_gensymtypes_c = $(CPP) -D__GENKSYMS__ $(c_flags) $< | $(genksyms) 127 + endif # CONFIG_GENDWARFKSYMS 117 128 118 129 # LLVM assembly 119 130 # Generate .ll files from .c ··· 297 286 # This is convoluted. The .S file must first be preprocessed to run guards and 298 287 # expand names, then the resulting exports must be constructed into plain 299 288 # EXPORT_SYMBOL(symbol); to build our dummy C file, and that gets preprocessed 300 - # to make the genksyms input. 289 + # to make the genksyms input or compiled into an object for gendwarfksyms. 301 290 # 302 291 # These mirror gensymtypes_c and co above, keep them in synch. 303 - cmd_gensymtypes_S = \ 304 - { echo "\#include <linux/kernel.h>" ; \ 305 - echo "\#include <asm/asm-prototypes.h>" ; \ 306 - $(NM) $@ | sed -n 's/.* __export_symbol_\(.*\)/EXPORT_SYMBOL(\1);/p' ; } | \ 307 - $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms) 292 + getasmexports = \ 293 + { echo "\#include <linux/kernel.h>" ; \ 294 + echo "\#include <linux/string.h>" ; \ 295 + echo "\#include <asm/asm-prototypes.h>" ; \ 296 + $(call getexportsymbols,EXPORT_SYMBOL(\1);) ; } 297 + 298 + ifdef CONFIG_GENDWARFKSYMS 299 + cmd_gensymtypes_S = \ 300 + $(getasmexports) | \ 301 + $(CC) $(c_flags) -c -o $(@:.o=.gendwarfksyms.o) -xc -; \ 302 + $(call getexportsymbols,\1) | \ 303 + $(gendwarfksyms) $(@:.o=.gendwarfksyms.o) 304 + else 305 + cmd_gensymtypes_S = \ 306 + $(getasmexports) | \ 307 + $(CPP) -D__GENKSYMS__ $(c_flags) -xc - | $(genksyms) 308 + endif # CONFIG_GENDWARFKSYMS 308 309 309 310 quiet_cmd_cpp_s_S = CPP $(quiet_modtag) $@ 310 311 cmd_cpp_s_S = $(CPP) $(a_flags) -o $@ $<