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

Changed files
+40 -23
Documentation
process
scripts
+12
Documentation/process/changes.rst
··· 32 32 GNU C 5.1 gcc --version 33 33 Clang/LLVM (optional) 11.0.0 clang --version 34 34 GNU make 3.81 make --version 35 + bash 4.2 bash --version 35 36 binutils 2.23 ld -v 36 37 flex 2.5.35 flex --version 37 38 bison 2.0 bison --version ··· 84 83 ---- 85 84 86 85 You will need GNU make 3.81 or later to build the kernel. 86 + 87 + Bash 88 + ---- 89 + 90 + Some bash scripts are used for the kernel build. 91 + Bash 4.2 or newer is needed. 87 92 88 93 Binutils 89 94 -------- ··· 368 361 ---- 369 362 370 363 - <ftp://ftp.gnu.org/gnu/make/> 364 + 365 + Bash 366 + ---- 367 + 368 + - <ftp://ftp.gnu.org/gnu/bash/> 371 369 372 370 Binutils 373 371 --------
+2 -2
scripts/Makefile.build
··· 251 251 252 252 # To make this rule robust against "Argument list too long" error, 253 253 # ensure to add $(obj)/ prefix by a shell command. 254 - cmd_mod = echo $(call real-search, $*.o, .o, -objs -y -m) | \ 255 - $(AWK) -v RS='( |\n)' '!x[$$0]++ { print("$(obj)/"$$0) }' > $@ 254 + cmd_mod = printf '%s\n' $(call real-search, $*.o, .o, -objs -y -m) | \ 255 + $(AWK) '!x[$$0]++ { print("$(obj)/"$$0) }' > $@ 256 256 257 257 $(obj)/%.mod: FORCE 258 258 $(call if_changed,mod)
+21 -15
scripts/check-local-export
··· 8 8 9 9 set -e 10 10 11 + # catch errors from ${NM} 12 + set -o pipefail 13 + 14 + # Run the last element of a pipeline in the current shell. 15 + # Without this, the while-loop would be executed in a subshell, and 16 + # the changes made to 'symbol_types' and 'export_symbols' would be lost. 17 + shopt -s lastpipe 18 + 11 19 declare -A symbol_types 12 20 declare -a export_symbols 13 21 14 22 exit_code=0 15 23 24 + # If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm) shows 25 + # 'no symbols' diagnostic (but exits with 0). It is harmless and hidden by 26 + # '2>/dev/null'. However, it suppresses real error messages as well. Add a 27 + # hand-crafted error message here. 28 + # 29 + # TODO: 30 + # Use --quiet instead of 2>/dev/null when we upgrade the minimum version of 31 + # binutils to 2.37, llvm to 13.0.0. 32 + # Then, the following line will be really simple: 33 + # ${NM} --quiet ${1} | 34 + 35 + { ${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } } | 16 36 while read value type name 17 37 do 18 38 # Skip the line if the number of fields is less than 3. ··· 57 37 if [[ ${name} == __ksymtab_* ]]; then 58 38 export_symbols+=(${name#__ksymtab_}) 59 39 fi 60 - 61 - # If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm) 62 - # shows 'no symbols' diagnostic (but exits with 0). It is harmless and 63 - # hidden by '2>/dev/null'. However, it suppresses real error messages 64 - # as well. Add a hand-crafted error message here. 65 - # 66 - # Use --quiet instead of 2>/dev/null when we upgrade the minimum version 67 - # of binutils to 2.37, llvm to 13.0.0. 68 - # 69 - # Then, the following line will be really simple: 70 - # done < <(${NM} --quiet ${1}) 71 - done < <(${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } ) 72 - 73 - # Catch error in the process substitution 74 - wait $! 40 + done 75 41 76 42 for name in "${export_symbols[@]}" 77 43 do
+3 -3
scripts/gdb/linux/config.py
··· 24 24 filename = arg 25 25 26 26 try: 27 - py_config_ptr = gdb.parse_and_eval("kernel_config_data + 8") 28 - py_config_size = gdb.parse_and_eval( 29 - "sizeof(kernel_config_data) - 1 - 8 * 2") 27 + py_config_ptr = gdb.parse_and_eval("&kernel_config_data") 28 + py_config_ptr_end = gdb.parse_and_eval("&kernel_config_data_end") 29 + py_config_size = py_config_ptr_end - py_config_ptr 30 30 except gdb.error as e: 31 31 raise gdb.GdbError("Can't find config, enable CONFIG_IKCONFIG?") 32 32
+2 -3
scripts/nsdeps
··· 34 34 local mod=${1%.ko:} 35 35 shift 36 36 local namespaces="$*" 37 - local mod_source_files="`cat $mod.mod | sed -n 1p \ 38 - | sed -e 's/\.o/\.c/g' \ 39 - | sed "s|[^ ]* *|${src_prefix}&|g"`" 37 + local mod_source_files=$(sed "s|^\(.*\)\.o$|${src_prefix}\1.c|" $mod.mod) 38 + 40 39 for ns in $namespaces; do 41 40 echo "Adding namespace $ns to module $mod.ko." 42 41 generate_deps_for_ns $ns "$mod_source_files"