All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH kbuild RFC] kbuild: fix modpost throwing away module symvers when linking vmlinux.o
@ 2020-05-01 22:43 Marek Behún
  2020-05-02 18:29 ` Marek Behun
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Behún @ 2020-05-01 22:43 UTC (permalink / raw
  To: linux-kbuild; +Cc: Marek Behún, Masahiro Yamada, Michal Marek

If vmlinux.o is rebuilt after modules, the current modpost code throws
away the information already stored in Module.symvers. This is due to
commit mentioned in the Fixes tag, which introduced this
backward-incompatible change which may break ceratin build systems (such
as that of OpenWRT).

Add code to look if modules.order is present when doing modpost for
vmlinux.o, and if it is, include it in modpost.

The change introduced here is ugly, therefore this is only a RFC patch.
Please comment whether fixing this backward-incompatibility is
acceptable.

Fixes: a721588d9475 ("kbuild: modpost: do not parse unnecessary ...")
Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Michal Marek <michal.lkml@markovi.net>
---
 scripts/Makefile.modpost | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost
index 952fff485546..d1eb4923e21b 100644
--- a/scripts/Makefile.modpost
+++ b/scripts/Makefile.modpost
@@ -60,7 +60,12 @@ MODPOST = scripts/mod/modpost						\
 ifdef MODPOST_VMLINUX
 
 quiet_cmd_modpost = MODPOST vmlinux.o
+ifeq ($(wildcard $(MODORDER)),)
       cmd_modpost = $(MODPOST) vmlinux.o
+else
+MODPOST += $(subst -i,-n,$(filter -i,$(MAKEFLAGS))) -s -T -
+      cmd_modpost = sed 's/ko$$/o/' $(MODORDER) | $(MODPOST) vmlinux.o
+endif
 
 __modpost:
 	$(call cmd,modpost)
-- 
2.24.1

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

* Re: [PATCH kbuild RFC] kbuild: fix modpost throwing away module symvers when linking vmlinux.o
  2020-05-01 22:43 [PATCH kbuild RFC] kbuild: fix modpost throwing away module symvers when linking vmlinux.o Marek Behún
@ 2020-05-02 18:29 ` Marek Behun
  2020-05-16  2:44   ` Masahiro Yamada
  0 siblings, 1 reply; 3+ messages in thread
From: Marek Behun @ 2020-05-02 18:29 UTC (permalink / raw
  To: linux-kbuild; +Cc: Masahiro Yamada, Michal Marek

Just to note how this breaks things:

On OpenWRT this may happen
1. make modules is run
   - Module.symvers contains symbols from modules
2. make Image/bzImage is run (as part of another OpenWRT make target)
   - Module.symvers is rewritten to contain only vmlinux.o symbols
3. external kernel modules try to build (wireguard, mac80211)
   - this now fails because external modules may depend on symbols from
     other modules and this information isn't in Module.symvers anymore

Marek

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

* Re: [PATCH kbuild RFC] kbuild: fix modpost throwing away module symvers when linking vmlinux.o
  2020-05-02 18:29 ` Marek Behun
@ 2020-05-16  2:44   ` Masahiro Yamada
  0 siblings, 0 replies; 3+ messages in thread
From: Masahiro Yamada @ 2020-05-16  2:44 UTC (permalink / raw
  To: Marek Behun; +Cc: Linux Kbuild mailing list, Michal Marek

On Sun, May 3, 2020 at 3:29 AM Marek Behun <marek.behun@nic.cz> wrote:
>
> Just to note how this breaks things:
>
> On OpenWRT this may happen
> 1. make modules is run
>    - Module.symvers contains symbols from modules
> 2. make Image/bzImage is run (as part of another OpenWRT make target)
>    - Module.symvers is rewritten to contain only vmlinux.o symbols
> 3. external kernel modules try to build (wireguard, mac80211)
>    - this now fails because external modules may depend on symbols from
>      other modules and this information isn't in Module.symvers anymore
>
> Marek


Is this a regression by a721588d9475 ?

I can reproduce it even before that commit.


$ git checkout a721588d^
HEAD is now at acf2a1397a68 kbuild: modpost: remove unnecessary
dependency for __modpost
$ make mrproper
  [ snip ]
$ make defconfig
  [ snip]
$ make -j24 modules
  [ snip ]
$ cat Module.symvers
0x00000000 nf_log_dump_packet_common net/netfilter/nf_log_common
EXPORT_SYMBOL_GPL
0x00000000 nf_log_l2packet net/netfilter/nf_log_common EXPORT_SYMBOL_GPL
0x00000000 nf_log_dump_sk_uid_gid net/netfilter/nf_log_common EXPORT_SYMBOL_GPL
0x00000000 nf_log_dump_tcp_header net/netfilter/nf_log_common EXPORT_SYMBOL_GPL
0x00000000 nf_log_dump_udp_header net/netfilter/nf_log_common EXPORT_SYMBOL_GPL

$ make -j24 bzImage
  [ snip ]
$ grep  -v  vmlinux   Module.symvers
  [ nothing is printed.  symbols from nf_log_common.ko are gone. ]


I can change it, but this is a long-standing behavior, I think.






--
Best Regards

Masahiro Yamada

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

end of thread, other threads:[~2020-05-16  2:45 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-01 22:43 [PATCH kbuild RFC] kbuild: fix modpost throwing away module symvers when linking vmlinux.o Marek Behún
2020-05-02 18:29 ` Marek Behun
2020-05-16  2:44   ` Masahiro Yamada

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.