Skip to content

Commit

Permalink
Merge tag 'kbuild-fixes-v6.10' of git://git.kernel.org/pub/scm/linux/…
Browse files Browse the repository at this point in the history
…kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Fix a Kconfig bug regarding comparisons to 'm' or 'n'

 - Replace missed $(srctree)/$(src)

 - Fix unneeded kallsyms step 3

 - Remove incorrect "compatible" properties from image nodes in
   image.fit

 - Improve gen_kheaders.sh

 - Fix 'make dt_binding_check'

 - Clean up unnecessary code

* tag 'kbuild-fixes-v6.10' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  dt-bindings: kbuild: Fix dt_binding_check on unconfigured build
  kheaders: use `command -v` to test for existence of `cpio`
  kheaders: explicitly define file modes for archived headers
  scripts/make_fit: Drop fdt image entry compatible string
  kbuild: remove a stale comment about cleaning in link-vmlinux.sh
  kbuild: fix short log for AS in link-vmlinux.sh
  kbuild: change scripts/mksysmap into sed script
  kbuild: avoid unneeded kallsyms step 3
  kbuild: scripts/gdb: Replace missed $(srctree)/$(src) w/ $(src)
  kconfig: remove redundant check in expr_join_or()
  kconfig: fix comparison to constant symbols, 'm', 'n'
  kconfig: remove unused expr_is_no()
  • Loading branch information
torvalds committed Jun 1, 2024
2 parents bbeb121 + 1b1c9f0 commit ec9eeb8
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 41 deletions.
9 changes: 7 additions & 2 deletions kernel/gen_kheaders.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@ include/
arch/$SRCARCH/include/
"

type cpio > /dev/null
if ! command -v cpio >/dev/null; then
echo >&2 "***"
echo >&2 "*** 'cpio' could not be found."
echo >&2 "***"
exit 1
fi

# Support incremental builds by skipping archive generation
# if timestamps of files being archived are not changed.
Expand Down Expand Up @@ -84,7 +89,7 @@ find $cpio_dir -type f -print0 |

# Create archive and try to normalize metadata for reproducibility.
tar "${KBUILD_BUILD_TIMESTAMP:+--mtime=$KBUILD_BUILD_TIMESTAMP}" \
--owner=0 --group=0 --sort=name --numeric-owner \
--owner=0 --group=0 --sort=name --numeric-owner --mode=u=rw,go=r,a+X \
-I $XZ -cf $tarfile -C $cpio_dir/ . > /dev/null

echo $headers_md5 > kernel/kheaders.md5
Expand Down
2 changes: 1 addition & 1 deletion scripts/dtc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# *** Also keep .gitignore in sync when changing ***
hostprogs-always-$(CONFIG_DTC) += dtc fdtoverlay
hostprogs-always-$(CHECK_DT_BINDING) += dtc
hostprogs-always-$(CHECK_DTBS) += dtc

dtc-objs := dtc.o flattree.o fstree.o data.o livetree.o treesource.o \
srcpos.o checks.o util.o
Expand Down
2 changes: 1 addition & 1 deletion scripts/gdb/linux/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ifdef building_out_of_srctree
symlinks := $(patsubst $(src)/%,%,$(wildcard $(src)/*.py))

quiet_cmd_symlink = SYMLINK $@
cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(abspath $(srctree))/$(src)/%,$@) $@
cmd_symlink = ln -fsn $(patsubst $(obj)/%,$(src)/%,$@) $@

always-y += $(symlinks)
$(addprefix $(obj)/, $(symlinks)): FORCE
Expand Down
2 changes: 1 addition & 1 deletion scripts/kconfig/expr.c
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,7 @@ static struct expr *expr_join_or(struct expr *e1, struct expr *e2)
return expr_alloc_comp(E_UNEQUAL, sym1, &symbol_yes);
}
}
if (sym1->type == S_BOOLEAN && sym1 == sym2) {
if (sym1->type == S_BOOLEAN) {
if ((e1->type == E_NOT && e1->left.expr->type == E_SYMBOL && e2->type == E_SYMBOL) ||
(e2->type == E_NOT && e2->left.expr->type == E_SYMBOL && e1->type == E_SYMBOL))
return expr_alloc_symbol(&symbol_yes);
Expand Down
5 changes: 0 additions & 5 deletions scripts/kconfig/expr.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,11 +302,6 @@ static inline int expr_is_yes(struct expr *e)
return !e || (e->type == E_SYMBOL && e->left.sym == &symbol_yes);
}

static inline int expr_is_no(struct expr *e)
{
return e && (e->type == E_SYMBOL && e->left.sym == &symbol_no);
}

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 4 additions & 2 deletions scripts/kconfig/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,23 @@

struct symbol symbol_yes = {
.name = "y",
.type = S_TRISTATE,
.curr = { "y", yes },
.menus = LIST_HEAD_INIT(symbol_yes.menus),
.flags = SYMBOL_CONST|SYMBOL_VALID,
};

struct symbol symbol_mod = {
.name = "m",
.type = S_TRISTATE,
.curr = { "m", mod },
.menus = LIST_HEAD_INIT(symbol_mod.menus),
.flags = SYMBOL_CONST|SYMBOL_VALID,
};

struct symbol symbol_no = {
.name = "n",
.type = S_TRISTATE,
.curr = { "n", no },
.menus = LIST_HEAD_INIT(symbol_no.menus),
.flags = SYMBOL_CONST|SYMBOL_VALID,
Expand Down Expand Up @@ -820,8 +823,7 @@ const char *sym_get_string_value(struct symbol *sym)
case no:
return "n";
case mod:
sym_calc_value(modules_sym);
return (modules_sym->curr.tri == no) ? "n" : "m";
return "m";
case yes:
return "y";
}
Expand Down
9 changes: 4 additions & 5 deletions scripts/link-vmlinux.sh
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ kallsyms_step()
kallsyms_S=${kallsyms_vmlinux}.S

vmlinux_link ${kallsyms_vmlinux} "${kallsymso_prev}" ${btf_vmlinux_bin_o}
mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms ${kallsymso_prev}
mksysmap ${kallsyms_vmlinux} ${kallsyms_vmlinux}.syms
kallsyms ${kallsyms_vmlinux}.syms ${kallsyms_S}

info AS ${kallsyms_S}
info AS ${kallsymso}
${CC} ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS} \
${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \
-c -o ${kallsymso} ${kallsyms_S}
Expand All @@ -193,15 +193,14 @@ kallsyms_step()
mksysmap()
{
info NM ${2}
${CONFIG_SHELL} "${srctree}/scripts/mksysmap" ${1} ${2} ${3}
${NM} -n "${1}" | "${srctree}/scripts/mksysmap" > "${2}"
}

sorttable()
{
${objtree}/scripts/sorttable ${1}
}

# Delete output files in case of error
cleanup()
{
rm -f .btf.*
Expand Down Expand Up @@ -282,7 +281,7 @@ if is_enabled CONFIG_DEBUG_INFO_BTF && is_enabled CONFIG_BPF; then
${RESOLVE_BTFIDS} vmlinux
fi

mksysmap vmlinux System.map ${kallsymso}
mksysmap vmlinux System.map

if is_enabled CONFIG_BUILDTIME_TABLE_SORT; then
info SORTTAB vmlinux
Expand Down
3 changes: 1 addition & 2 deletions scripts/make_fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def output_dtb(fsw, seq, fname, arch, compress):
Args:
fsw (libfdt.FdtSw): Object to use for writing
seq (int): Sequence number (1 for first)
fmame (str): Filename containing the DTB
fname (str): Filename containing the DTB
arch: FIT architecture, e.g. 'arm64'
compress (str): Compressed algorithm, e.g. 'gzip'
Expand All @@ -211,7 +211,6 @@ def output_dtb(fsw, seq, fname, arch, compress):
fsw.property_string('type', 'flat_dt')
fsw.property_string('arch', arch)
fsw.property_string('compression', compress)
fsw.property('compatible', bytes(compat))

with open(fname, 'rb') as inf:
compressed = compress_data(inf, compress)
Expand Down
28 changes: 6 additions & 22 deletions scripts/mksysmap
Original file line number Diff line number Diff line change
@@ -1,22 +1,16 @@
#!/bin/sh -x
# Based on the vmlinux file create the System.map file
#!/bin/sed -f
# SPDX-License-Identifier: GPL-2.0-only
#
# sed script to filter out symbols that are not needed for System.map,
# or not suitable for kallsyms. The input should be 'nm -n <file>'.
#
# System.map is used by module-init tools and some debugging
# tools to retrieve the actual addresses of symbols in the kernel.
#
# Usage
# mksysmap vmlinux System.map [exclude]


#####
# Generate System.map (actual filename passed as second argument)
# The following refers to the symbol type as per nm(1).

# readprofile starts reading symbols when _stext is found, and
# continue until it finds a symbol which is not either of 'T', 't',
# 'W' or 'w'.
#

${NM} -n ${1} | sed >${2} -e "
# ---------------------------------------------------------------------------
# Ignored symbol types
#
Expand Down Expand Up @@ -92,13 +86,3 @@ ${NM} -n ${1} | sed >${2} -e "
# ppc stub
/\.long_branch\./d
/\.plt_branch\./d
# ---------------------------------------------------------------------------
# Ignored kallsyms symbols
#
# If the 3rd parameter exists, symbols from it will be omitted from the output.
# This makes kallsyms have the identical symbol lists in the step 1 and 2.
# Without this, the step2 would get new symbols generated by scripts/kallsyms.c
# when CONFIG_KALLSYMS_ALL is enabled. That might require one more pass.
$(if [ $# -ge 3 ]; then ${NM} ${3} | sed -n '/ U /!s:.* \([^ ]*\)$:/ \1$/d:p'; fi)
"

0 comments on commit ec9eeb8

Please sign in to comment.