Skip to content

Commit 60ae1b1

Browse files
committed
kbuild: remove the first line of *.mod files
The current format of *.mod is like this: line 1: directory path to the .ko file line 2: a list of objects linked into this module line 3: unresolved symbols (only when CONFIG_TRIM_UNUSED_KSYMS=y) Now that *.mod and *.ko are created in the same directory, the line 1 provides no valuable information. It can be derived by replacing the extension .mod with .ko. In fact, nobody uses the first line any more. Cut down the first line. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
1 parent b7dca6d commit 60ae1b1

File tree

3 files changed

+6
-11
lines changed

3 files changed

+6
-11
lines changed

scripts/Makefile.build

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
274274
$(single-used-m): $(obj)/%.o: $(src)/%.c $(recordmcount_source) $(objtool_dep) FORCE
275275
$(call cmd,force_checksrc)
276276
$(call if_changed_rule,cc_o_c)
277-
@{ echo $(@:.o=.ko); echo $@; \
277+
@{ echo $@; \
278278
$(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@)
279279

280280
quiet_cmd_cc_lst_c = MKLST $@
@@ -456,7 +456,7 @@ quiet_cmd_link_multi-m = LD [M] $@
456456

457457
$(multi-used-m): FORCE
458458
$(call if_changed,link_multi-m)
459-
@{ echo $(@:.o=.ko); echo $(filter %.o,$^); \
459+
@{ echo $(filter %.o,$^); \
460460
$(cmd_undef_syms); } > $(patsubst %.o,%.mod,$@)
461461
$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
462462

scripts/adjust_autoksyms.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#
99

1010
# Create/update the include/generated/autoksyms.h file from the list
11-
# of all module's needed symbols as recorded on the third line of *.mod files.
11+
# of all module's needed symbols as recorded on the second line of *.mod files.
1212
#
1313
# For each symbol being added or removed, the corresponding dependency
1414
# file's timestamp is updated to force a rebuild of the affected source
@@ -47,7 +47,7 @@ cat > "$new_ksyms_file" << EOT
4747
4848
EOT
4949
sed 's/ko$/mod/' modules.order |
50-
xargs -n1 sed -n -e '3{s/ /\n/g;/^$/!p;}' -- |
50+
xargs -n1 sed -n -e '2{s/ /\n/g;/^$/!p;}' -- |
5151
sort -u |
5252
sed -e 's/\(.*\)/#define __KSYM_\1 1/' >> "$new_ksyms_file"
5353

scripts/mod/sumversion.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
398398
char *sources, *end, *fname;
399399
char filelist[PATH_MAX + 1];
400400

401-
/* objects for a module are listed in the second line of *.mod file. */
401+
/* objects for a module are listed in the first line of *.mod file. */
402402
snprintf(filelist, sizeof(filelist), "%.*smod",
403403
(int)strlen(modname) - 1, modname);
404404

@@ -407,13 +407,8 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
407407
/* not a module or .mod file missing - ignore */
408408
return;
409409

410-
sources = strchr(file, '\n');
411-
if (!sources) {
412-
warn("malformed versions file for %s\n", modname);
413-
goto release;
414-
}
410+
sources = file;
415411

416-
sources++;
417412
end = strchr(sources, '\n');
418413
if (!end) {
419414
warn("bad ending versions file for %s\n", modname);

0 commit comments

Comments
 (0)