Re: [PATCH 2/2] selftests/vm: fix incorrect gcc invocation in some cases

From: Jason Gunthorpe
Date: Tue Sep 15 2020 - 14:49:36 EST


On Mon, Sep 14, 2020 at 06:29:01PM -0700, John Hubbard wrote:
> Avoid accidental wrong builds, due to built-in rules working just a
> little bit too well--but not quite as well as required for our situation
> here.
>
> In other words, "make userfaultfd" (for example) is supposed to fail to
> build at all, because this Makefile only supports either "make" (all),
> or "make /full/path". However, the built-in rules, if not suppressed,
> will pick up CFLAGS and the initial LDLIBS (but not the target-specific
> LDLIBS, because those are only set for the full path target!). This
> causes it to get pretty far into building things despite using incorrect
> values such as an *occasionally* incomplete LDLIBS value.
>
> Signed-off-by: John Hubbard <jhubbard@xxxxxxxxxx>
> ---
> tools/testing/selftests/vm/Makefile | 12 ++++++++++++
> 1 file changed, 12 insertions(+)

I hit this too when fiddling with the hmm tests! Would be happy to see
better errors

Jason