]> git.baikalelectronics.ru Git - kernel.git/commit
kbuild: avoid split lines in .mod files
authorMasahiro Yamada <masahiroy@kernel.org>
Thu, 3 Dec 2020 17:55:51 +0000 (02:55 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Sun, 6 Dec 2020 12:09:28 +0000 (21:09 +0900)
commit145a73d5e6d9155f54a83dbdc1899de53525c82d
treecb0980de0fd312257278f0f02d27d265451f5336
parente5bf191b549de1eade3dcc4603af73495b26b422
kbuild: avoid split lines in .mod files

"xargs echo" is not a safe way to remove line breaks because the input
may exceed the command line limit and xargs may break it up into
multiple invocations of echo. This should never happen because
scripts/gen_autoksyms.sh expects all undefined symbols are placed in
the second line of .mod files.

One possible way is to replace "xargs echo" with
"sed ':x;N;$!bx;s/\n/ /g'" or something, but I rewrote the code by
using awk because it is more readable.

This issue was reported by Sami Tolvanen; in his Clang LTO patch set,
$(multi-used-m) is no longer an ELF object, but a thin archive that
contains LLVM bitcode files. llvm-nm prints out symbols for each
archive member separately, which results a lot of dupications, in some
places, beyond the system-defined limit.

This problem must be fixed irrespective of LTO, and we must ensure
zero possibility of having this issue.

Link: https://lkml.org/lkml/2020/12/1/1658
Reported-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
scripts/Makefile.build