From: Nick Alcock Date: Fri, 27 Jun 2014 14:11:21 +0000 (+0100) Subject: kbuild/ctf: Fix out-of-tree module build when CONFIG_CTF=n. X-Git-Tag: v4.1.12-92~313^2~35 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8f1622b3ada68f43f4093933c715f7659d5dbb08;p=users%2Fjedix%2Flinux-maple.git kbuild/ctf: Fix out-of-tree module build when CONFIG_CTF=n. When doing an out-of-tree build against a kernel with CONFIG_CTF=n (such as debug kernels), linking fails because the list of object files in the command-line given to the linker is empty. The object files are substituted by this line in Makefile.modpost: $(patsubst $(ctf-dir)/%,,$(filter-out FORCE,$^)) which takes the list of prerequisites for the module (which includes all its CTF type information as well as its object files and a FORCE dummy target) and filters out the FORCE target and all the CTF prerequisites (they are not linked at this stage, but objcopied in immediately afterward). This works because all the CTF files are generated under the $(ctf-dir) directory, and nothing else is kept under there. Unfortunately $(ctf-dir) is left empty if CONFIG_CTF=n. This is unproblematic in normal kernel builds because all paths are relative, but if an out-of-tree module build is being performed this strips everything out of the link line, since out-of-tree builds usually specify all object files using absolute pathnames, which naturally begin with a slash, and when $(ctf-dir) is empty so does the patsubst pattern. The solution is to provide a non-empty expansion of ctf-dir when CONFIG_CTF=n: any value that can't appear at the start of object file names will do. Orabug: 19078361 Reported-by: Knut Omang Signed-off-by: Nick Alcock Reviewed-by: Jamie Iles Signed-off-by: Guangyu Sun --- diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index cec7ba293f2a..50943ab281e2 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -251,6 +251,7 @@ else # !CONFIG_CTF module-ctfs-modular-prereq = module-ctfs-builtin = module-ctf-flags = +ctf-dir = ///.nonexistent cmd-touch-ctf = @: endif