]> www.infradead.org Git - users/jedix/linux-maple.git/commit
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)
commit8f1622b3ada68f43f4093933c715f7659d5dbb08
tree412c6dbf6c446b0ea41f1200282d959fb8b2d81d
parentb766fdd1c4298f3f68069478a9614d5065fa7ae5
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 <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