[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNATztV-a3maL+vqQhbVsLBD_dsy+wbOZQ5ofQfbZQGGuLA@mail.gmail.com>
Date: Thu, 19 Dec 2019 11:00:15 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Johan Hovold <johan@...nel.org>
Cc: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>,
Michal Marek <michal.lkml@...kovi.net>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>, Rob Herring <robh@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Sascha Hauer <kernel@...gutronix.de>,
kbuild test robot <lkp@...el.com>,
Linux Kbuild mailing list <linux-kbuild@...r.kernel.org>
Subject: Re: kbuild obj-m directory descend (was: Re: [PATCH] serdev: fix
builds with CONFIG_SERIAL_DEV_BUS=m)
Hi.
On Thu, Dec 19, 2019 at 2:23 AM Johan Hovold <johan@...nel.org> wrote:
>
> On Wed, Dec 18, 2019 at 09:38:42AM +0100, Uwe Kleine-König wrote:
> > Commit 54edb425346a ("serdev: simplify Makefile") broke builds with
> > serdev configured as module. I don't understand it completely yet, but
> > it seems that
> >
> > obj-$(CONFIG_SERIAL_DEV_BUS) += serdev/
> >
> > in drivers/tty/Makefile with CONFIG_SERIAL_DEV_BUS=m doesn't result in
> > code that is added using obj-y in drivers/tty/serdev/Makefile being
> > compiled. So instead of dropping $(CONFIG_SERIAL_DEV_BUS) in serdev's
> > Makefile, drop it in drivers/tty/Makefile.
>
> I was just looking into this when you commented on this off-list.
>
> The offending patch is broken since it effectively makes
> CONFIG_SERIAL_DEV_BUS bool (built-in or disabled), but for some reason
> those symbols do not end up in vmlinux (despite being compiled) when you
> add a built-in object goal under a directory that was entered using
> obj-m.
>
> That seems like a bug to me and contradicts the kbuild documentation
> (3.6):
>
> Example:
>
> #fs/Makefile
> obj-$(CONFIG_EXT2_FS) += ext2/
>
> If CONFIG_EXT2_FS is set to either ‘y’ (built-in) or ‘m’
> (modular) the corresponding obj- variable will be set, and
> kbuild will descend down in the ext2 directory. Kbuild only uses
> this information to decide that it needs to visit the directory,
> it is the Makefile in the subdirectory that specifies what is
> modular and what is built-in.
>
> I tried adding other targets to obj-y directly and they are also are not
> included, seemingly since the directory was entered using obj-m.
>
> Masahiro or Michal, can you shed some light?
>
> Johan
I saw similar questions in ML in the past.
Yes, this is how Kbuild works;
Kbuild only links objects in Makefiles visited by obj-y.
If you use
obj-m += serdev/
all objects in serdev/ are considered as modular.
I think it is better to make the document
clarify this.
--
Best Regards
Masahiro Yamada
Powered by blists - more mailing lists