From: Nick Alcock Date: Fri, 13 Sep 2013 15:13:13 +0000 (+0100) Subject: kbuild/ctf: Use shell expansion, not $(wildcard ...), for CTF section copying. X-Git-Tag: v4.1.12-92~313^2~56 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=992ab081be996e09804e72c8e03cd702f208d512;p=users%2Fjedix%2Flinux-maple.git kbuild/ctf: Use shell expansion, not $(wildcard ...), for CTF section copying. The stub module kernel/ctf/ctf.ko must contain sections for all CTF for the core kernel, CTF shared between modules and CTF for every built-in module. This set can vary as the kernel configuration changes: it is computed by dwarf2ctf from objects.builtin, modules.builtin, and analysis of the debugging information in the object files comprising the kernel build. This means that we must dynamically construct the command line for the objcopy which inserts these sections into the final .ko, as it is not known until recipes are executed. This is done via the module-ctf-flags variable, which is expanded into cmd_ld_ko_o. We chose to use the GNU Make wildcard function to determine the set of builtin modules, but this has turned out to be problematic, because, though it is nowhere documented, the output of this function is often cached if the directory exists. glob lookups will rescan it as needed, but $(wildcard) seemingly does not, and can often produce inaccurate or even empty lists even when many files matching the wildcard have existed for some time. This shows up as (often parallel) makes failing to insert any CTF sections into kernel/ctf/ctf.ko, with DTrace subsequently failing because the CTF for the core kernel and inter-module shared types was missing. For now, work around this bug by using shell expansion instead. (This particular part of the module-ctf-flags is only expanded once, for one module, and only after a period of computation by dwarf2ctf lasting many minutes, so no negative impact on build times from this shell loop is expected.) Orabug: 17445637 Signed-off-by: Nick Alcock --- diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 5e4dcc197c6e..ebeef7c89269 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -218,8 +218,9 @@ ctf-module-name = $(addprefix $(ctf-dir)/,$(notdir $(basename $@)).mod.ctf) module-ctf-flags = $(if $(filter ctf.ko,$(notdir $@)), \ --strip-debug \ - $(foreach builtin,$(wildcard $(ctf-dir)/*.builtin.ctf), \ - --add-section $(patsubst %.builtin.ctf,.ctf.%,$(notdir $(builtin)))=$(builtin)), \ + $(shell for builtin in $(ctf-dir)/*.builtin.ctf; do \ + printf "%s" "--add-section .ctf.$$(basename $$builtin .builtin.ctf)=$$builtin "; \ + done), \ --add-section .ctf=$(ctf-module-name)) # We have to put content in our dummy no-CTF files because --add-section