All of lore.kernel.org
 help / color / mirror / Atom feed
* Module build problems with gmake 3.x
@ 2021-09-03 22:06 Markus Mayer
  2021-09-09 12:19 ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Mayer @ 2021-09-03 22:06 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Kbuild Mailing List

Hi,

We are running into build issues with some external kernel modules if
the GNUmake version is 3.x and the kernel is recent(-ish). The culprit
seems to be the sub-make invocation when GNUmake < 4 is detected:
    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=688931a5ad4e

The module build works fine for older kernels (those not containing
this patch) even with GNUmake 3.81. And it works fine with GNUmake >=
4 with any kernel, even those with the above patch. In other words, if
the sub-make invocation doesn't take place (either because make is new
enough or because the kernel doesn't have the version check yet), our
module build does work as intended.

Due to how the build is integrated with other components, we need to
be calling "make -e" to have environment variables take precedence,
which seems to be another piece of the puzzle. The problem doesn't
seem to be happening without "-e".

The ingredients for our problem, therefore, seem to be:
    * old GNUmake (<4)
    * newish kernel  (>=5.1)
    * run make -e

I should also mention that the kernel module is being cross-compiled
for ARM and ARM64, although that does not seem to be playing a role
here. In my example below, I was using the native compiler.

The problem we are observing is that the contents of $(M) and
$(CFLAGS_MODULE) are lost during the extra sub-make invocation that is
conditional upon GNUmake < 4. There might be other lost variables,
too, but we haven't noticed any effects if there are.

Losing $(M) causes the build to go off the rails completely. This is
easily detected and can be worked around by setting $(KBUILD_EXTMOD)
directly and foregoing $(M) on the command line altogether. The loss
of $(CFLAGS_MODULE) is a little more insidious, since the build does
succeed even when it's empty. However, required defines remain unset
despite being set in the top-level makefile. The resulting kernel
module doesn't work (which can lead to a lot of head scratching). I
also don't know of a way of working around losing CFLAGS_MODULE's
contents.

I was able to reproduce the loss of $(M) quite easily doing something like this:

obj-m += hello.o

all:
        ${MAKE} -C $(KERNEL_DIR) -e M=$(PWD) modules

clean:
        make -C $(KERNEL_DIR) M=$(PWD) clean

Instead of building the out-of-tree hello.ko, which we are asking it
to do, it'll go off and build all the in-kernel modules instead. Since
it sees $(M) as empty, it just executes "make modules".

Unfortunately, I have NOT been successful reproducing losing the
contents of $(CFLAGS_MODULE) in a simple test environment. In my
tests, it was always retained. Nonetheless, in the actual build
environment, it does get lost. And only in the combination of new-ish
kernel and old-ish make, i.e. whenever the sub-make invocation happens
due to the make version.

BTW, commenting out the make version test does make our module build
work. So, it is definitely related to that code snippet. (Of course,
building on a reasonably recent Linux distro also makes everything
work, but that isn't possible for us in all circumstances.)

Do you have any thoughts on this or any pointers? Is there a way this
issue could be resolved? It does seem like the version check has some
unintended side-effects, even if the scenario in which one would come
across them is fairly uncommon and most developers will never
experience them.

I am willing to try out any suggestions or provide further information
if needed.

Regards,
-Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Module build problems with gmake 3.x
  2021-09-03 22:06 Module build problems with gmake 3.x Markus Mayer
@ 2021-09-09 12:19 ` Masahiro Yamada
  2021-09-10 22:45   ` Markus Mayer
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2021-09-09 12:19 UTC (permalink / raw)
  To: Markus Mayer; +Cc: Kbuild Mailing List

On Sat, Sep 4, 2021 at 7:06 AM Markus Mayer <mmayer@broadcom.com> wrote:
>
> Hi,
>
> We are running into build issues with some external kernel modules if
> the GNUmake version is 3.x and the kernel is recent(-ish). The culprit
> seems to be the sub-make invocation when GNUmake < 4 is detected:
>     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=688931a5ad4e
>
> The module build works fine for older kernels (those not containing
> this patch) even with GNUmake 3.81. And it works fine with GNUmake >=
> 4 with any kernel, even those with the above patch. In other words, if
> the sub-make invocation doesn't take place (either because make is new
> enough or because the kernel doesn't have the version check yet), our
> module build does work as intended.
>
> Due to how the build is integrated with other components, we need to
> be calling "make -e" to have environment variables take precedence,
> which seems to be another piece of the puzzle. The problem doesn't
> seem to be happening without "-e".
>
> The ingredients for our problem, therefore, seem to be:
>     * old GNUmake (<4)
>     * newish kernel  (>=5.1)
>     * run make -e
>
> I should also mention that the kernel module is being cross-compiled
> for ARM and ARM64, although that does not seem to be playing a role
> here. In my example below, I was using the native compiler.
>
> The problem we are observing is that the contents of $(M) and
> $(CFLAGS_MODULE) are lost during the extra sub-make invocation that is
> conditional upon GNUmake < 4. There might be other lost variables,
> too, but we haven't noticed any effects if there are.
>
> Losing $(M) causes the build to go off the rails completely. This is
> easily detected and can be worked around by setting $(KBUILD_EXTMOD)
> directly and foregoing $(M) on the command line altogether. The loss
> of $(CFLAGS_MODULE) is a little more insidious, since the build does
> succeed even when it's empty. However, required defines remain unset
> despite being set in the top-level makefile. The resulting kernel
> module doesn't work (which can lead to a lot of head scratching). I
> also don't know of a way of working around losing CFLAGS_MODULE's
> contents.


I sometimes test GNU make 3.81 for kernel builds, but I have not tested
the -e option.

Now I tested the -e option, and it worked for me.
Both $(M) and $(KBUILD_EXTMOD) were correctly set.

So, I did not observe anything you claim.



> I was able to reproduce the loss of $(M) quite easily doing something like this:
>
> obj-m += hello.o
>
> all:
>         ${MAKE} -C $(KERNEL_DIR) -e M=$(PWD) modules
>
> clean:
>         make -C $(KERNEL_DIR) M=$(PWD) clean





I ran this Makefile with GNU Make 3.81


masahiro@oscar:~/workspace/hello$ cat Makefile
obj-m += hello.o

KERNEL_DIR := $(HOME)/ref/linux

all:
        ${MAKE} -C $(KERNEL_DIR) -e M=$(PWD) modules

clean:
        make -C $(KERNEL_DIR) M=$(PWD) clean
masahiro@oscar:~/workspace/hello$ make-3.81 --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-unknown-linux-gnu
masahiro@oscar:~/workspace/hello$ make-3.81
make-3.81 -C /home/masahiro/ref/linux -e
M=/home/masahiro/workspace/hello modules
make-3.81[1]: Entering directory `/home/masahiro/ref/linux'
make-3.81[2]: Entering directory `/home/masahiro/ref/linux'
  CC [M]  /home/masahiro/workspace/hello/hello.o
  MODPOST /home/masahiro/workspace/hello/Module.symvers
  CC [M]  /home/masahiro/workspace/hello/hello.mod.o
  LD [M]  /home/masahiro/workspace/hello/hello.ko
make-3.81[2]: Leaving directory `/home/masahiro/ref/linux'
make-3.81[1]: Leaving directory `/home/masahiro/ref/linux'
masahiro@oscar:~/workspace/hello$ ls hello*
hello.c  hello.ko  hello.mod  hello.mod.c  hello.mod.o  hello.o





hello.ko was successfully built.


Entering/Leaving directory is eye-sores,
but presumably it is because MAKEFLAGS is overridden
by the environment since you gave -e.

I do not understand your motivation for using -e, though.






> Instead of building the out-of-tree hello.ko, which we are asking it
> to do, it'll go off and build all the in-kernel modules instead. Since
> it sees $(M) as empty, it just executes "make modules".
>
> Unfortunately, I have NOT been successful reproducing losing the
> contents of $(CFLAGS_MODULE) in a simple test environment. In my
> tests, it was always retained. Nonetheless, in the actual build
> environment, it does get lost. And only in the combination of new-ish
> kernel and old-ish make, i.e. whenever the sub-make invocation happens
> due to the make version.
>
> BTW, commenting out the make version test does make our module build
> work. So, it is definitely related to that code snippet. (Of course,
> building on a reasonably recent Linux distro also makes everything
> work, but that isn't possible for us in all circumstances.)
>
> Do you have any thoughts on this or any pointers? Is there a way this
> issue could be resolved? It does seem like the version check has some
> unintended side-effects, even if the scenario in which one would come
> across them is fairly uncommon and most developers will never
> experience them.
>
> I am willing to try out any suggestions or provide further information
> if needed.
>
> Regards,
> -Markus



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Module build problems with gmake 3.x
  2021-09-09 12:19 ` Masahiro Yamada
@ 2021-09-10 22:45   ` Markus Mayer
  2021-09-12 16:03     ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Markus Mayer @ 2021-09-10 22:45 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Kbuild Mailing List

On Thu, 9 Sept 2021 at 05:20, Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> I sometimes test GNU make 3.81 for kernel builds, but I have not tested
> the -e option.
>
> Now I tested the -e option, and it worked for me.
> Both $(M) and $(KBUILD_EXTMOD) were correctly set.
>
> So, I did not observe anything you claim.

Thanks for trying it out. See below for a summary of my test comparing
GNUmake 3.81 and 4.1. All the tests have been performed on Ubuntu
14.04. (Yes, I know that's old.)

> I ran this Makefile with GNU Make 3.81
>
> masahiro@oscar:~/workspace/hello$ cat Makefile
> obj-m += hello.o
>
> KERNEL_DIR := $(HOME)/ref/linux
>
> all:
>         ${MAKE} -C $(KERNEL_DIR) -e M=$(PWD) modules
>
> clean:
>         make -C $(KERNEL_DIR) M=$(PWD) clean
> masahiro@oscar:~/workspace/hello$ make-3.81 --version
> GNU Make 3.81
> Copyright (C) 2006  Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.
> There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
> PARTICULAR PURPOSE.
>
> This program built for x86_64-unknown-linux-gnu
> masahiro@oscar:~/workspace/hello$ make-3.81
> make-3.81 -C /home/masahiro/ref/linux -e
> M=/home/masahiro/workspace/hello modules
> make-3.81[1]: Entering directory `/home/masahiro/ref/linux'
> make-3.81[2]: Entering directory `/home/masahiro/ref/linux'
>   CC [M]  /home/masahiro/workspace/hello/hello.o
>   MODPOST /home/masahiro/workspace/hello/Module.symvers
>   CC [M]  /home/masahiro/workspace/hello/hello.mod.o
>   LD [M]  /home/masahiro/workspace/hello/hello.ko
> make-3.81[2]: Leaving directory `/home/masahiro/ref/linux'
> make-3.81[1]: Leaving directory `/home/masahiro/ref/linux'
> masahiro@oscar:~/workspace/hello$ ls hello*
> hello.c  hello.ko  hello.mod  hello.mod.c  hello.mod.o  hello.o
>
> hello.ko was successfully built.
>
> Entering/Leaving directory is eye-sores,
> but presumably it is because MAKEFLAGS is overridden
> by the environment since you gave -e.

Here is what I have.

$ cat Makefile

export KERNEL_DIR = /local/users/mmayer/linux-5.4
export CFLAGS_MODULE = -DGREETING_NAME='"Linux"'

obj-m += hello-1.o

all:
    ${MAKE} -C $(KERNEL_DIR) -e -r M=$(PWD) modules

clean:
    make -C $(KERNEL_DIR) M=$(PWD) clean

$ cat hello-1.c
/*
 *  hello-1.c - The simplest kernel module.
 */
#include <linux/module.h> /* Needed by all modules */
#include <linux/kernel.h> /* Needed for KERN_INFO */

int init_module(void)
{
    printk(KERN_INFO "Hello " GREETING_NAME ".\n");
    return 0;
}

void cleanup_module(void)
{
    printk(KERN_INFO "Goodbye " GREETING_NAME ".\n");
}

MODULE_LICENSE("GPL");

Now, if I run make 3.81, this happens. Please note that I added some
extra output to the top-level Linux Makefile, which is where some of
the extra output is coming from.

$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for x86_64-pc-linux-gnu

$ make
hello: CFLAGS_MODULE=-DGREETING_NAME='"Linux"'
hello: KBUILD_EXTMOD=
make -C /local/users/mmayer/linux-5.4 -e -r M=/local/users/mmayer/hello modules
need-sub-make
make[1]: Entering directory `/local/users/mmayer/linux-5.4'
1) CFLAGS_MODULE=-DGREETING_NAME='Linux'
KBUILD_CFLAGS_MODULE=
CFLAGS_MODULE[make]=-DGREETING_NAME='Linux'
CFLAGS_MODULE[env]=-DGREETING_NAME='"Linux"'
Invoking sub-make...
abs_srctree=/local/users/mmayer/linux-5.4
MAKECMDGOALS=modules
make -C /local/users/mmayer/linux-5.4 -f
/local/users/mmayer/linux-5.4/Makefile modules
make[2]: Entering directory `/local/users/mmayer/linux-5.4'
KBUILD_CFLAGS_MODULE=-DMODULE
CFLAGS_MODULE=
KBUILD_CFLAGS_MODULE=-DMODULE
CFLAGS_MODULE=
KBUILD_CFLAGS_MODULE=-DMODULE
CFLAGS_MODULE=
  CALL    scripts/checksyscalls.sh
  CALL    scripts/atomic/check-atomics.sh
warning: Cannot use CONFIG_STACK_VALIDATION=y, please install
libelf-dev, libelf-devel or elfutils-libelf-devel
2) KBUILD_CFLAGS_MODULE=-DMODULE
2) CFLAGS_MODULE=
build=-f ./scripts/Makefile.build obj, @=init
2) KBUILD_CFLAGS_MODULE=-DMODULE
2) CFLAGS_MODULE=
build=-f ./scripts/Makefile.build obj, @=usr
2) KBUILD_CFLAGS_MODULE=-DMODULE
2) CFLAGS_MODULE=
build=-f ./scripts/Makefile.build obj, @=arch/x86
[...]

As you can see, it doesn't pass the value of $(M). Instead, it is
running "make modules" because it sees $(M) as empty.

If I use make 4.1, it works, even though nothing has changed except
for "make" itself.

$ ../make-4.2.1/make --version
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

$ ../make-4.2.1/make
hello: CFLAGS_MODULE=-DGREETING_NAME='"Linux"'
hello: KBUILD_EXTMOD=
M=/local/users/mmayer/hello modules
/local/users/mmayer/hello/../make-4.2.1/make -C
/local/users/mmayer/linux-5.4 -e -r M=/local/users/mmayer/hello
modules
make[1]: Entering directory '/local/users/mmayer/linux-5.4'
KBUILD_CFLAGS_MODULE=-DMODULE
CFLAGS_MODULE[make]=-DGREETING_NAME='Linux'
CFLAGS_MODULE[env]=-DGREETING_NAME='"Linux"'
2) KBUILD_CFLAGS_MODULE=-DMODULE
2) CFLAGS_MODULE=-DGREETING_NAME='Linux'
build=-f ./scripts/Makefile.build obj, @=/local/users/mmayer/hello
make[2]: Entering directory '/local/users/mmayer/linux-5.4'
hello: CFLAGS_MODULE=-DGREETING_NAME='"Linux"'
hello: KBUILD_EXTMOD=/local/users/mmayer/hello
  CC [M]  /local/users/mmayer/hello/hello-1.o
make[2]: Leaving directory '/local/users/mmayer/linux-5.4'
make[2]: Entering directory '/local/users/mmayer/linux-5.4'
hello: CFLAGS_MODULE=-DGREETING_NAME='"Linux"'
hello: KBUILD_EXTMOD=/local/users/mmayer/hello
  Building modules, stage 2.
  MODPOST 1 modules
make[3]: Entering directory '/local/users/mmayer/linux-5.4'
  CC [M]  /local/users/mmayer/hello/hello-1.mod.o
  LD [M]  /local/users/mmayer/hello/hello-1.ko
make[3]: Leaving directory '/local/users/mmayer/linux-5.4'
make[2]: Leaving directory '/local/users/mmayer/linux-5.4'
make[1]: Leaving directory '/local/users/mmayer/linux-5.4'

$ lsb_release -d
Description: Ubuntu 14.04.5 LTS

> I do not understand your motivation for using -e, though.

I am not entirely clear on that either, but I have been told it is
needed in that particular build environment.

Regards,
-Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Module build problems with gmake 3.x
  2021-09-10 22:45   ` Markus Mayer
@ 2021-09-12 16:03     ` Masahiro Yamada
  2021-09-21 23:58       ` Markus Mayer
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2021-09-12 16:03 UTC (permalink / raw)
  To: Markus Mayer; +Cc: Kbuild Mailing List

On Sat, Sep 11, 2021 at 7:45 AM Markus Mayer <mmayer@broadcom.com> wrote:
>
> On Thu, 9 Sept 2021 at 05:20, Masahiro Yamada <masahiroy@kernel.org> wrote:
> >
> > I sometimes test GNU make 3.81 for kernel builds, but I have not tested
> > the -e option.
> >
> > Now I tested the -e option, and it worked for me.
> > Both $(M) and $(KBUILD_EXTMOD) were correctly set.
> >
> > So, I did not observe anything you claim.
>
> Thanks for trying it out. See below for a summary of my test comparing
> GNUmake 3.81 and 4.1. All the tests have been performed on Ubuntu
> 14.04. (Yes, I know that's old.)
>
> > I ran this Makefile with GNU Make 3.81
> >
> > masahiro@oscar:~/workspace/hello$ cat Makefile
> > obj-m += hello.o
> >
> > KERNEL_DIR := $(HOME)/ref/linux
> >
> > all:
> >         ${MAKE} -C $(KERNEL_DIR) -e M=$(PWD) modules
> >
> > clean:
> >         make -C $(KERNEL_DIR) M=$(PWD) clean
> > masahiro@oscar:~/workspace/hello$ make-3.81 --version
> > GNU Make 3.81
> > Copyright (C) 2006  Free Software Foundation, Inc.
> > This is free software; see the source for copying conditions.
> > There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
> > PARTICULAR PURPOSE.
> >
> > This program built for x86_64-unknown-linux-gnu
> > masahiro@oscar:~/workspace/hello$ make-3.81
> > make-3.81 -C /home/masahiro/ref/linux -e
> > M=/home/masahiro/workspace/hello modules
> > make-3.81[1]: Entering directory `/home/masahiro/ref/linux'
> > make-3.81[2]: Entering directory `/home/masahiro/ref/linux'
> >   CC [M]  /home/masahiro/workspace/hello/hello.o
> >   MODPOST /home/masahiro/workspace/hello/Module.symvers
> >   CC [M]  /home/masahiro/workspace/hello/hello.mod.o
> >   LD [M]  /home/masahiro/workspace/hello/hello.ko
> > make-3.81[2]: Leaving directory `/home/masahiro/ref/linux'
> > make-3.81[1]: Leaving directory `/home/masahiro/ref/linux'
> > masahiro@oscar:~/workspace/hello$ ls hello*
> > hello.c  hello.ko  hello.mod  hello.mod.c  hello.mod.o  hello.o
> >
> > hello.ko was successfully built.
> >
> > Entering/Leaving directory is eye-sores,
> > but presumably it is because MAKEFLAGS is overridden
> > by the environment since you gave -e.
>
> Here is what I have.
>
> $ cat Makefile
>
> export KERNEL_DIR = /local/users/mmayer/linux-5.4


From this line, I understand how to reproduce the case.

The key is 'linux-5.4'

In your initial email, you mentioned that this happened on

  * newish kernel  (>=5.1)


So, I used the latest kernel for testing,
but this does not happen after
bcf637f54f6d2515d4c9c81808faf01848916152
because the M= parameter is parsed before the sub-make.


By running your test code on linux 5.4, yes,
I can observe the same symptom.




The root case seams, GNU Make changes
the origin of variables to 'environment'.
I do not know if it is an intended behavior.
(maybe, better to ask the GNU Make maintainer)



I narrowed it down to the following test code.
To me, the behavior is weird.



masahiro@oscar:~/workspace/foo$ cat Makefile
$(warning the origin of FOO is: $(origin FOO))

all:
        $(MAKE) -e -f Makefile.sub1 FOO=1
masahiro@oscar:~/workspace/foo$ cat Makefile.sub1
$(warning the origin of FOO is: $(origin FOO))

all:
        $(MAKE) -f Makefile.sub2
masahiro@oscar:~/workspace/foo$ cat Makefile.sub2
$(warning the origin of FOO is: $(origin FOO))

all:
        @:
masahiro@oscar:~/workspace/foo$ make
Makefile:1: the origin of FOO is: undefined
make -e -f Makefile.sub1 FOO=1
make[1]: Entering directory '/home/masahiro/workspace/foo'
Makefile.sub1:1: the origin of FOO is: command line
make -f Makefile.sub2
make[2]: Entering directory '/home/masahiro/workspace/foo'
Makefile.sub2:1: the origin of FOO is: environment
make[2]: Leaving directory '/home/masahiro/workspace/foo'
make[1]: Leaving directory '/home/masahiro/workspace/foo'






So, this is what your can tell:

- The behavior of the -e option seems to have a weird
    side-effect.
    Later, I will ask this to the GNU Make maintainer
    to see whether it is a bug or not.

- I do not want to support the -e option.  I do not think
  it is a commonly-used option because you are the
  first person who asked this since Linux 5.4.
  (notice Linux 5.4 is almost two years old)

 - If you use the latest kernel
    (after bcf637f54f6d251), you will be able to build
    external modules with the -e option.
    But, I recommend you to not use -e.

 - If you still insist on the -e option on Linux 5.4,
    you can cherry-pick bcf637f54f6d251
    (but it is out of scope of the support of the community)




>
> > I do not understand your motivation for using -e, though.
>
> I am not entirely clear on that either, but I have been told it is
> needed in that particular build environment.


Maybe, better to consider removing the -e option.






-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Module build problems with gmake 3.x
  2021-09-12 16:03     ` Masahiro Yamada
@ 2021-09-21 23:58       ` Markus Mayer
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Mayer @ 2021-09-21 23:58 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: Kbuild Mailing List

On Sun, 12 Sept 2021 at 09:04, Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> On Sat, Sep 11, 2021 at 7:45 AM Markus Mayer <mmayer@broadcom.com> wrote:
> >
> > Here is what I have.
> >
> > $ cat Makefile
> >
> > export KERNEL_DIR = /local/users/mmayer/linux-5.4
>
>
> From this line, I understand how to reproduce the case.
>
> The key is 'linux-5.4'

Sorry about that. I am glad to not be dealing with 4.9 that much
anymore, so 5.4 is still "new-ish" to me. And 5.10 is the bleeding
edge in my world. Goes to show that everything is relative.

> In your initial email, you mentioned that this happened on
>
>   * newish kernel  (>=5.1)
>
> So, I used the latest kernel for testing,
> but this does not happen after
> bcf637f54f6d2515d4c9c81808faf01848916152
> because the M= parameter is parsed before the sub-make.
>
> By running your test code on linux 5.4, yes,
> I can observe the same symptom.

Thanks for trying out a 5.4 kernel.

> The root case seams, GNU Make changes
> the origin of variables to 'environment'.
> I do not know if it is an intended behavior.
> (maybe, better to ask the GNU Make maintainer)

[...]

> So, this is what your can tell:
>
> - The behavior of the -e option seems to have a weird
>     side-effect.
>     Later, I will ask this to the GNU Make maintainer
>     to see whether it is a bug or not.
>
> - I do not want to support the -e option.  I do not think
>   it is a commonly-used option because you are the
>   first person who asked this since Linux 5.4.
>   (notice Linux 5.4 is almost two years old)
>
>  - If you use the latest kernel
>     (after bcf637f54f6d251), you will be able to build
>     external modules with the -e option.
>     But, I recommend you to not use -e.
>
>  - If you still insist on the -e option on Linux 5.4,
>     you can cherry-pick bcf637f54f6d251
>     (but it is out of scope of the support of the community)
>
> Maybe, better to consider removing the -e option.

I will forward the recommendation to see what can be done. Cherry
picking the patch you are recommending should tide us over in the
meantime. I will give it a shot.

Thanks for your help.

Regards,
-Markus

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-09-21 23:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03 22:06 Module build problems with gmake 3.x Markus Mayer
2021-09-09 12:19 ` Masahiro Yamada
2021-09-10 22:45   ` Markus Mayer
2021-09-12 16:03     ` Masahiro Yamada
2021-09-21 23:58       ` Markus Mayer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.