Kbuild fixes for v5.19

- Make the *.mod build rule portable for POSIX awk
 
  - Fix regression of 'make nsdeps'
 
  - Make scripts/check-local-export working for older bash versions
 
  - Fix scripts/gdb to extract the .config data from vmlinux
 -----BEGIN PGP SIGNATURE-----
 
 iQJJBAABCgAzFiEEbmPs18K1szRHjPqEPYsBB53g2wYFAmKk7n0VHG1hc2FoaXJv
 eUBrZXJuZWwub3JnAAoJED2LAQed4NsGFv0P/RNPUu+hhNkQB41nIyDkn977KtM4
 QqEdXUaGVEXEMwcBYn7bo4LR/pxbRX73WJ2o3ONwSTnpmbwDkSwmJX0JADuUhFKh
 je7E/+Sv9wJsyZ93Tow/nTt13xCcox9QSxx2wZrS06GQz6EmU34N+sXx82tffH8L
 ONQq36p31JKCwTuaK9oiAz+FAH6ap9sStL6WBrS+HSpinO0s5P9xTtTrdZHTYmn2
 KgFofMZvGAMEjGZsi2H3nobjH52/yZoUyfDanFS4DAS2ZMMQ5Vw8MpCxuKz8G2oN
 /VCo3HgK9D+0uaAwPag3z+hugHoMBU5cjNhsvjiO6veB/VEHxm5KoEATo4xmU2OZ
 W7GGp3FCsxrZkSkXtKO6FAJatN/DlgHYoJ647xo/yNOxULgzVCZgAs/cPUqUW9l2
 bFNeDJ4YIiFDCwi65/KOAyLOpQT8j/wMEWmrrk57HBkrSaBrHhkNV31d3Y5HUnr2
 XhjqGk4dX+YX8WAEN0LrjLzUQNntqxk2yvITi0m4OaIvblu0XU2B0F70WRqhXxaf
 cmQFysAhmcaFSrlWxiNOnLPENNQjSy5jeKU/f6ZpGcYu7MU09ay3P+eoqFoPGq24
 dLBqdLd52QDJQAo91y05cUJrj6IRYNsEK7HYlvokmvfmGHjfclxdM4+rT6dBwHpf
 ih8aP2eTxRMIwqgY
 =ka85
 -----END PGP SIGNATURE-----

Merge tag 'kbuild-fixes-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild

Pull Kbuild fixes from Masahiro Yamada:

 - Make the *.mod build rule portable for POSIX awk

 - Fix regression of 'make nsdeps'

 - Make scripts/check-local-export working for older bash versions

 - Fix scripts/gdb to extract the .config data from vmlinux

* tag 'kbuild-fixes-v5.19' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
  scripts/gdb: change kernel config dumping method
  scripts/check-local-export: avoid 'wait $!' for process substitution
  scripts/nsdeps: adjust to the format change of *.mod files
  kbuild: avoid regex RS for POSIX awk
This commit is contained in:
Linus Torvalds 2022-06-12 11:10:07 -07:00
commit e3b8e2de19
5 changed files with 40 additions and 23 deletions

View File

@ -32,6 +32,7 @@ you probably needn't concern yourself with pcmciautils.
GNU C 5.1 gcc --version
Clang/LLVM (optional) 11.0.0 clang --version
GNU make 3.81 make --version
bash 4.2 bash --version
binutils 2.23 ld -v
flex 2.5.35 flex --version
bison 2.0 bison --version
@ -84,6 +85,12 @@ Make
You will need GNU make 3.81 or later to build the kernel.
Bash
----
Some bash scripts are used for the kernel build.
Bash 4.2 or newer is needed.
Binutils
--------
@ -362,6 +369,11 @@ Make
- <ftp://ftp.gnu.org/gnu/make/>
Bash
----
- <ftp://ftp.gnu.org/gnu/bash/>
Binutils
--------

View File

@ -251,8 +251,8 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE
# To make this rule robust against "Argument list too long" error,
# ensure to add $(obj)/ prefix by a shell command.
cmd_mod = echo $(call real-search, $*.o, .o, -objs -y -m) | \
$(AWK) -v RS='( |\n)' '!x[$$0]++ { print("$(obj)/"$$0) }' > $@
cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \
$(AWK) '!x[$$0]++ { print("$(obj)/"$$0) }' > $@
$(obj)/%.mod: FORCE
$(call if_changed,mod)

View File

@ -8,11 +8,31 @@
set -e
# catch errors from ${NM}
set -o pipefail
# Run the last element of a pipeline in the current shell.
# Without this, the while-loop would be executed in a subshell, and
# the changes made to 'symbol_types' and 'export_symbols' would be lost.
shopt -s lastpipe
declare -A symbol_types
declare -a export_symbols
exit_code=0
# If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm) shows
# 'no symbols' diagnostic (but exits with 0). It is harmless and hidden by
# '2>/dev/null'. However, it suppresses real error messages as well. Add a
# hand-crafted error message here.
#
# TODO:
# Use --quiet instead of 2>/dev/null when we upgrade the minimum version of
# binutils to 2.37, llvm to 13.0.0.
# Then, the following line will be really simple:
# ${NM} --quiet ${1} |
{ ${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } } |
while read value type name
do
# Skip the line if the number of fields is less than 3.
@ -37,21 +57,7 @@ do
if [[ ${name} == __ksymtab_* ]]; then
export_symbols+=(${name#__ksymtab_})
fi
# If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm)
# shows 'no symbols' diagnostic (but exits with 0). It is harmless and
# hidden by '2>/dev/null'. However, it suppresses real error messages
# as well. Add a hand-crafted error message here.
#
# Use --quiet instead of 2>/dev/null when we upgrade the minimum version
# of binutils to 2.37, llvm to 13.0.0.
#
# Then, the following line will be really simple:
# done < <(${NM} --quiet ${1})
done < <(${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } )
# Catch error in the process substitution
wait $!
done
for name in "${export_symbols[@]}"
do

View File

@ -24,9 +24,9 @@ class LxConfigDump(gdb.Command):
filename = arg
try:
py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8")
py_config_size = gdb.parse_and_eval(
"sizeof(kernel_config_data) - 1 - 8 * 2")
py_config_ptr = gdb.parse_and_eval("&kernel_config_data")
py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end")
py_config_size = py_config_ptr_end - py_config_ptr
except gdb.error as e:
raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?")

View File

@ -34,9 +34,8 @@ generate_deps() {
local mod=${1%.ko:}
shift
local namespaces="$*"
local mod_source_files="`cat $mod.mod | sed -n 1p \
| sed -e 's/\.o/\.c/g' \
| sed "s|[^ ]* *|${src_prefix}&|g"`"
local mod_source_files=$(sed "s|^\(.*\)\.o$|${src_prefix}\1.c|" $mod.mod)
for ns in $namespaces; do
echo "Adding namespace $ns to module $mod.ko."
generate_deps_for_ns $ns "$mod_source_files"