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: enable objtool for *.mod.o and additional kernel objects

Currently, objtool is disabled in scripts/Makefile.{modfinal,vmlinux}.

This commit moves rule_cc_o_c and rule_as_o_S to scripts/Makefile.lib
and set objtool-enabled to y there.

With this change, *.mod.o, .module-common.o, builtin-dtb.o, and
vmlinux.export.o will now be covered by objtool.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>

+29 -28
-23
scripts/Makefile.build
··· 129 129 130 130 is-single-obj-m = $(and $(part-of-module),$(filter $@, $(obj-m)),y) 131 131 132 - # When a module consists of a single object, there is no reason to keep LLVM IR. 133 - # Make $(LD) covert LLVM IR to ELF here. 134 - ifdef CONFIG_LTO_CLANG 135 - cmd_ld_single_m = $(if $(is-single-obj-m), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@) 136 - endif 137 - 138 132 ifdef CONFIG_MODVERSIONS 139 133 # When module versioning is enabled the following steps are executed: 140 134 # o compile a <file>.o from <file>.c ··· 188 194 ifneq ($(findstring 1, $(KBUILD_EXTRA_WARN)),) 189 195 cmd_warn_shared_object = $(if $(word 2, $(modname-multi)),$(warning $(kbuild-file): $*.o is added to multiple modules: $(modname-multi))) 190 196 endif 191 - 192 - define rule_cc_o_c 193 - $(call cmd_and_fixdep,cc_o_c) 194 - $(call cmd,checksrc) 195 - $(call cmd,checkdoc) 196 - $(call cmd,gen_objtooldep) 197 - $(call cmd,gen_symversions_c) 198 - $(call cmd,record_mcount) 199 - $(call cmd,warn_shared_object) 200 - endef 201 - 202 - define rule_as_o_S 203 - $(call cmd_and_fixdep,as_o_S) 204 - $(call cmd,gen_objtooldep) 205 - $(call cmd,gen_symversions_S) 206 - $(call cmd,warn_shared_object) 207 - endef 208 197 209 198 # Built-in and composite module parts 210 199 $(obj)/%.o: $(obj)/%.c $(recordmcount_source) FORCE
+25 -1
scripts/Makefile.lib
··· 302 302 # =========================================================================== 303 303 # These are shared by some Makefile.* files. 304 304 305 + objtool-enabled := y 306 + 307 + ifdef CONFIG_LTO_CLANG 308 + # objtool cannot process LLVM IR. Make $(LD) covert LLVM IR to ELF here. 309 + cmd_ld_single = $(if $(objtool-enabled), ; $(LD) $(ld_flags) -r -o $(tmp-target) $@; mv $(tmp-target) $@) 310 + endif 311 + 305 312 quiet_cmd_cc_o_c = CC $(quiet_modtag) $@ 306 313 cmd_cc_o_c = $(CC) $(c_flags) -c -o $@ $< \ 307 - $(cmd_ld_single_m) \ 314 + $(cmd_ld_single) \ 308 315 $(cmd_objtool) 316 + 317 + define rule_cc_o_c 318 + $(call cmd_and_fixdep,cc_o_c) 319 + $(call cmd,checksrc) 320 + $(call cmd,checkdoc) 321 + $(call cmd,gen_objtooldep) 322 + $(call cmd,gen_symversions_c) 323 + $(call cmd,record_mcount) 324 + $(call cmd,warn_shared_object) 325 + endef 309 326 310 327 quiet_cmd_as_o_S = AS $(quiet_modtag) $@ 311 328 cmd_as_o_S = $(CC) $(a_flags) -c -o $@ $< $(cmd_objtool) 329 + 330 + define rule_as_o_S 331 + $(call cmd_and_fixdep,as_o_S) 332 + $(call cmd,gen_objtooldep) 333 + $(call cmd,gen_symversions_S) 334 + $(call cmd,warn_shared_object) 335 + endef 312 336 313 337 # Copy a file 314 338 # ===========================================================================
+2 -2
scripts/Makefile.modfinal
··· 24 24 ccflags-remove-y := $(CC_FLAGS_CFI) 25 25 26 26 %.mod.o: %.mod.c FORCE 27 - $(call if_changed_dep,cc_o_c) 27 + $(call if_changed_rule,cc_o_c) 28 28 29 29 .module-common.o: $(srctree)/scripts/module-common.c FORCE 30 - $(call if_changed_dep,cc_o_c) 30 + $(call if_changed_rule,cc_o_c) 31 31 32 32 quiet_cmd_ld_ko_o = LD [M] $@ 33 33 cmd_ld_ko_o = \
+2 -2
scripts/Makefile.vmlinux
··· 10 10 targets := 11 11 12 12 %.o: %.c FORCE 13 - $(call if_changed_dep,cc_o_c) 13 + $(call if_changed_rule,cc_o_c) 14 14 15 15 %.o: %.S FORCE 16 - $(call if_changed_dep,as_o_S) 16 + $(call if_changed_rule,as_o_S) 17 17 18 18 # Built-in dtb 19 19 # ---------------------------------------------------------------------------