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: pass KBUILD_MODFILE when compiling builtin objects

When compiling, Kbuild passes KBUILD_BASENAME (basename of the object)
and KBUILD_MODNAME (basename of the module).

This commit adds another one, KBUILD_MODFILE, which is the path of
the module. (or, the path of the module it would end up in if it were
compiled as a module.)

The next commit will use this to generate modules.builtin without
tristate.conf.

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

+9 -6
+9 -6
scripts/Makefile.lib
··· 84 84 subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) 85 85 86 86 # Finds the multi-part object the current object will be linked into. 87 - # If the object belongs to two or more multi-part objects, all of them are 88 - # concatenated with a colon separator. 89 - modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\ 90 - $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=))))) 87 + # If the object belongs to two or more multi-part objects, list them all. 88 + modname-multi = $(sort $(foreach m,$(multi-used),\ 89 + $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m))),$(m:.o=)))) 91 90 92 - modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) 91 + __modname = $(if $(modname-multi),$(modname-multi),$(basetarget)) 92 + 93 + modname = $(subst $(space),:,$(__modname)) 94 + modfile = $(addprefix $(obj)/,$(__modname)) 93 95 94 96 # target with $(obj)/ and its suffix stripped 95 97 target-stem = $(basename $(patsubst $(obj)/%,%,$@)) ··· 102 100 name-fix = $(call stringify,$(subst $(comma),_,$(subst -,_,$1))) 103 101 basename_flags = -DKBUILD_BASENAME=$(call name-fix,$(basetarget)) 104 102 modname_flags = -DKBUILD_MODNAME=$(call name-fix,$(modname)) 103 + modfile_flags = -DKBUILD_MODFILE=$(call stringify,$(modfile)) 105 104 106 105 orig_c_flags = $(KBUILD_CPPFLAGS) $(KBUILD_CFLAGS) \ 107 106 $(ccflags-y) $(CFLAGS_$(target-stem).o) ··· 161 158 modkern_cflags = \ 162 159 $(if $(part-of-module), \ 163 160 $(KBUILD_CFLAGS_MODULE) $(CFLAGS_MODULE), \ 164 - $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL)) 161 + $(KBUILD_CFLAGS_KERNEL) $(CFLAGS_KERNEL) $(modfile_flags)) 165 162 166 163 modkern_aflags = $(if $(part-of-module), \ 167 164 $(KBUILD_AFLAGS_MODULE) $(AFLAGS_MODULE), \