lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CABVgOSnkfmj5FXN5176g5J7Sjef8e+2w--3F52SWqtb34QCXEg@mail.gmail.com>
Date:   Tue, 28 Feb 2023 07:56:02 +0800
From:   David Gow <davidgow@...gle.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Shuah Khan <skhan@...uxfoundation.org>,
        Brendan Higgins <brendan.higgins@...ux.dev>,
        Rae Moar <rmoar@...gle.com>,
        Daniel Latypov <dlatypov@...gle.com>,
        Masahiro Yamada <masahiroy@...nel.org>,
        linux-kselftest@...r.kernel.org, kunit-dev@...glegroups.com,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kunit: Fix 'hooks.o' build by recursing into kunit

On Tue, 28 Feb 2023 at 06:43, Linus Torvalds
<torvalds@...ux-foundation.org> wrote:
>
> On Fri, Feb 24, 2023 at 5:45 PM David Gow <davidgow@...gle.com> wrote:
> >
> > +# Some KUnit files (hooks.o) need to be built-in even when KUnit is a module,
> > +# so we can't just use obj-$(CONFIG_KUNIT).
> > +ifdef CONFIG_KUNIT
> > +obj-y += kunit/
> >  endif
>
> We actually have a pattern for this, although I guess it's rare enough
> that "pattern" isn't necessarily the right word.
>
> But you can find things like the Hyper-V drivers having similar
> issues, and so the driver Makefile has
>
>     obj-$(subst m,y,$(CONFIG_HYPERV))       += hv/
>
> See a few other cases with
>
>     git grep "subst m,y,"
>
> but I guess the "ifdef CONFIG_KUNIT" thing works too. I can only find
> one case of that (in arch/mips/Kbuild).
>
> Another way of dealing with this - that is more common for individual
> object files rather than directories - is to just do
>
>     kunit-dir-$(CONFIG_KUNIT) := kunit/
>     obj-y += $(kunit-dir-y) $(kunit-dir-m)
>
> which admittedly is also not a hugely common pattern, but does exist
> in various places (see for example the 'sfp-bus.o' file and CONFIG_SFP
> in drivers/net/phy/Makefile.
>
> That last pattern is probably most common in scripts/Makefile.lib,
> where we have things like
>
>        hostprogs += $(hostprogs-always-y) $(hostprogs-always-m)
>
> which is similar but not the exact same thing.
>
> Anyway, I guess I'll just apply that patch as-is, I just wanted to
> point out that the particular pattern it uses may be simple, but we've
> generally tried to just do our Makefile evaluations with "arithmetic"
> rather than conditionals.
>
>               Linus

Thanks, Linus.

(And also thanks to Mikhail Gavrilov and Thorsten Leemhuis for testing
this change as well.)

It's certainly been an educational experience!

Of those other options, personally I find the "subst m,y" one most
obvious, but I'll probably leave it as the conditional for now, unless
you think trying to make it more consistent is worth the extra churn.

Regardless, I'll look into adding a note about this to
Documentation/kbuild/makefiles.rst.

Cheers,
-- David

Download attachment "smime.p7s" of type "application/pkcs7-signature" (4003 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ