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: change module.order to list *.o instead of *.ko

scripts/Makefile.build replaces the suffix .o with .ko, then
scripts/Makefile.modpost calls the sed command to change .ko back
to the original .o suffix.

Instead of converting the suffixes back-and-forth, store the .o paths
in modules.order, and replace it with .ko in 'make modules_install'.

This avoids the unneeded sed command.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>

+21 -21
+1 -1
Makefile
··· 1564 1564 rm -f $(MODLIB)/build ; \ 1565 1565 ln -s $(CURDIR) $(MODLIB)/build ; \ 1566 1566 fi 1567 - @sed 's:^:kernel/:' modules.order > $(MODLIB)/modules.order 1567 + @sed 's:^\(.*\)\.o$$:kernel/\1.ko:' modules.order > $(MODLIB)/modules.order 1568 1568 @cp -f modules.builtin $(MODLIB)/ 1569 1569 @cp -f $(objtree)/modules.builtin.modinfo $(MODLIB)/ 1570 1570
+1 -1
scripts/Makefile.build
··· 435 435 # modules.order unless contained modules are updated. 436 436 437 437 cmd_modules_order = { $(foreach m, $(real-prereqs), \ 438 - $(if $(filter %/modules.order, $m), cat $m, echo $(patsubst %.o,%.ko,$m));) :; } \ 438 + $(if $(filter %/modules.order, $m), cat $m, echo $m);) :; } \ 439 439 > $@ 440 440 441 441 $(obj)/modules.order: $(obj-m) FORCE
+3 -3
scripts/Makefile.modfinal
··· 15 15 # find all modules listed in modules.order 16 16 modules := $(call read-file, $(MODORDER)) 17 17 18 - __modfinal: $(modules) 18 + __modfinal: $(modules:%.o=%.ko) 19 19 @: 20 20 21 21 # modname and part-of-module are set to make c_flags define proper module flags ··· 57 57 printf '%s\n' 'cmd_$@ := $(make-cmd)' > $(dot-target).cmd, @:) 58 58 59 59 # Re-generate module BTFs if either module's .ko or vmlinux changed 60 - $(modules): %.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE 60 + %.ko: %.o %.mod.o scripts/module.lds $(and $(CONFIG_DEBUG_INFO_BTF_MODULES),$(KBUILD_BUILTIN),vmlinux) FORCE 61 61 +$(call if_changed_except,ld_ko_o,vmlinux) 62 62 ifdef CONFIG_DEBUG_INFO_BTF_MODULES 63 63 +$(if $(newer-prereqs),$(call cmd,btf_ko)) 64 64 endif 65 65 66 - targets += $(modules) $(modules:.ko=.mod.o) 66 + targets += $(modules:%.o=%.ko) $(modules:%.o=%.mod.o) 67 67 68 68 # Add FORCE to the prequisites of a target to force it to be always rebuilt. 69 69 # ---------------------------------------------------------------------------
+1 -1
scripts/Makefile.modinst
··· 26 26 suffix-$(CONFIG_MODULE_COMPRESS_XZ) := .xz 27 27 suffix-$(CONFIG_MODULE_COMPRESS_ZSTD) := .zst 28 28 29 - modules := $(patsubst $(extmod_prefix)%, $(dst)/%$(suffix-y), $(modules)) 29 + modules := $(patsubst $(extmod_prefix)%.o, $(dst)/%.ko$(suffix-y), $(modules)) 30 30 31 31 __modinst: $(modules) 32 32 @:
+5 -2
scripts/Makefile.modpost
··· 107 107 modpost-args += -w 108 108 endif 109 109 110 - modorder-if-needed := $(if $(KBUILD_MODULES), $(MODORDER)) 110 + ifdef KBUILD_MODULES 111 + modorder-if-needed := $(MODORDER) 112 + modpost-args += -T $(MODORDER) 113 + endif 111 114 112 115 MODPOST = scripts/mod/modpost 113 116 ··· 122 119 echo >&2 "WARNING: $(missing-input) is missing."; \ 123 120 echo >&2 " Modules may not have dependencies or modversions."; \ 124 121 echo >&2 " You may get many unresolved symbol warnings.";) \ 125 - sed 's/ko$$/o/' $(or $(modorder-if-needed), /dev/null) | $(MODPOST) $(modpost-args) -T - $(vmlinux.o-if-present) 122 + $(MODPOST) $(modpost-args) $(vmlinux.o-if-present) 126 123 127 124 targets += $(output-symdump) 128 125 $(output-symdump): $(modorder-if-needed) $(vmlinux.o-if-present) $(module.symvers-if-present) $(MODPOST) FORCE
+4 -4
scripts/clang-tools/gen_compile_commands.py
··· 138 138 """ 139 139 with open(modorder) as f: 140 140 for line in f: 141 - ko = line.rstrip() 142 - base, ext = os.path.splitext(ko) 143 - if ext != '.ko': 144 - sys.exit('{}: module path must end with .ko'.format(ko)) 141 + obj = line.rstrip() 142 + base, ext = os.path.splitext(obj) 143 + if ext != '.o': 144 + sys.exit('{}: module path must end with .o'.format(obj)) 145 145 mod = base + '.mod' 146 146 # Read from *.mod, to get a list of objects that compose the module. 147 147 with open(mod) as m:
+1 -1
scripts/gen_autoksyms.sh
··· 48 48 EOT 49 49 50 50 { 51 - [ -n "${read_modorder}" ] && sed 's/ko$/usyms/' modules.order | xargs cat 51 + [ -n "${read_modorder}" ] && sed 's/o$/usyms/' modules.order | xargs cat 52 52 echo "$needed_symbols" 53 53 [ -n "$ksym_wl" ] && cat "$ksym_wl" 54 54 } | sed -e 's/ /\n/g' | sed -n -e '/^$/!p' |
+4 -7
scripts/mod/modpost.c
··· 1856 1856 FILE *in = stdin; 1857 1857 char fname[PATH_MAX]; 1858 1858 1859 - if (strcmp(filename, "-") != 0) { 1860 - in = fopen(filename, "r"); 1861 - if (!in) 1862 - fatal("Can't open filenames file %s: %m", filename); 1863 - } 1859 + in = fopen(filename, "r"); 1860 + if (!in) 1861 + fatal("Can't open filenames file %s: %m", filename); 1864 1862 1865 1863 while (fgets(fname, PATH_MAX, in) != NULL) { 1866 1864 if (strends(fname, "\n")) ··· 1866 1868 read_symbols(fname); 1867 1869 } 1868 1870 1869 - if (in != stdin) 1870 - fclose(in); 1871 + fclose(in); 1871 1872 } 1872 1873 1873 1874 #define SZ 500
+1 -1
scripts/modules-check.sh
··· 16 16 for m in $(sed 's:.*/::' "$1" | sort | uniq -d) 17 17 do 18 18 echo "error: the following would cause module name conflict:" >&2 19 - sed -n "/\/$m/s:^: :p" "$1" >&2 19 + sed -n "/\/$m/s:^\(.*\)\.o\$: \1.ko:p" "$1" >&2 20 20 exit_code=1 21 21 done 22 22 }