]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
kbuild/ctf: Fix out-of-tree module build when CONFIG_CTF=n.
authorNick Alcock <nick.alcock@oracle.com>
Fri, 27 Jun 2014 14:11:21 +0000 (15:11 +0100)
committerNick Alcock <nick.alcock@oracle.com>
Tue, 21 Jul 2015 14:29:41 +0000 (15:29 +0100)
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 <knut.omang@oracle.com>
Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Jamie Iles <jamie.iles@oracle.com>
Signed-off-by: Guangyu Sun <guangyu.sun@oracle.com>
scripts/Makefile.modpost

index cec7ba293f2aa32dd643ccfe5d517a85b6f9d9dc..50943ab281e22572d989c5868d1dff038eba92d7 100644 (file)
@@ -251,6 +251,7 @@ else                # !CONFIG_CTF
 module-ctfs-modular-prereq =
 module-ctfs-builtin =
 module-ctf-flags =
+ctf-dir = ///.nonexistent
 cmd-touch-ctf = @:
 
 endif