Commit e3b8e2de authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge tag 'kbuild-fixes-v5.19' of...

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
parents 2275c6ba 1f7a6cf6
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -32,6 +32,7 @@ you probably needn't concern yourself with pcmciautils.
GNU C                  5.1              gcc --version
GNU C                  5.1              gcc --version
Clang/LLVM (optional)  11.0.0           clang --version
Clang/LLVM (optional)  11.0.0           clang --version
GNU make               3.81             make --version
GNU make               3.81             make --version
bash                   4.2              bash --version
binutils               2.23             ld -v
binutils               2.23             ld -v
flex                   2.5.35           flex --version
flex                   2.5.35           flex --version
bison                  2.0              bison --version
bison                  2.0              bison --version
@@ -84,6 +85,12 @@ Make


You will need GNU make 3.81 or later to build the kernel.
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
Binutils
--------
--------


@@ -362,6 +369,11 @@ Make


- <ftp://ftp.gnu.org/gnu/make/>
- <ftp://ftp.gnu.org/gnu/make/>


Bash
----

- <ftp://ftp.gnu.org/gnu/bash/>

Binutils
Binutils
--------
--------


+2 −2
Original line number Original line Diff line number Diff line
@@ -251,8 +251,8 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) FORCE


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


$(obj)/%.mod: FORCE
$(obj)/%.mod: FORCE
	$(call if_changed,mod)
	$(call if_changed,mod)
+21 −15
Original line number Original line Diff line number Diff line
@@ -8,11 +8,31 @@


set -e
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 symbol_types
declare -a export_symbols
declare -a export_symbols


exit_code=0
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
while read value type name
do
do
	# Skip the line if the number of fields is less than 3.
	# Skip the line if the number of fields is less than 3.
@@ -37,21 +57,7 @@ do
	if [[ ${name} == __ksymtab_* ]]; then
	if [[ ${name} == __ksymtab_* ]]; then
		export_symbols+=(${name#__ksymtab_})
		export_symbols+=(${name#__ksymtab_})
	fi
	fi

done
	# 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 $!


for name in "${export_symbols[@]}"
for name in "${export_symbols[@]}"
do
do
+3 −3
Original line number Original line Diff line number Diff line
@@ -24,9 +24,9 @@ class LxConfigDump(gdb.Command):
            filename = arg
            filename = arg


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


+2 −3
Original line number Original line Diff line number Diff line
@@ -34,9 +34,8 @@ generate_deps() {
	local mod=${1%.ko:}
	local mod=${1%.ko:}
	shift
	shift
	local namespaces="$*"
	local namespaces="$*"
	local mod_source_files="`cat $mod.mod | sed -n 1p                      \
	local mod_source_files=$(sed "s|^\(.*\)\.o$|${src_prefix}\1.c|" $mod.mod)
					      | sed -e 's/\.o/\.c/g'           \

					      | sed "s|[^ ]* *|${src_prefix}&|g"`"
	for ns in $namespaces; do
	for ns in $namespaces; do
		echo "Adding namespace $ns to module $mod.ko."
		echo "Adding namespace $ns to module $mod.ko."
		generate_deps_for_ns $ns "$mod_source_files"
		generate_deps_for_ns $ns "$mod_source_files"