Centos-kernel-stream-9/scripts/mod
Joel Slebodnick 82e011bd19 kbuild: get rid of duplication in *.mod files
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2160559
Tested: Kernel booted on Orin board with no warnings using device tree

commit 22f26f21774f838e97921952d8c5c4aab3da2ea4
Author: Masahiro Yamada <masahiroy@kernel.org>
Date:   Thu Apr 7 00:30:21 2022 +0900

    kbuild: get rid of duplication in *.mod files

    It is allowed to add the same objects multiple times to obj-y / obj-m:

      obj-y += foo.o foo.o foo.o
      obj-m += bar.o bar.o bar.o

    It is also allowed to add the same objects multiple times to a composite
    module:

      obj-m += foo.o
      foo-y := foo1.o foo2.o foo2.o foo1.o

    This flexibility is useful because the same object might be selected by
    different CONFIG options, like this:

      obj-m               += foo.o
      foo-y               := foo1.o
      foo-$(CONFIG_FOO_X) += foo2.o
      foo-$(CONFIG_FOO_Y) += foo2.o

    The duplicated objects are omitted at link time. It works naturally in
    Makefiles because GNU Make removes duplication in $^ without changing
    the order.

    It is working well, almost...

    A small flaw I notice is, *.mod contains duplication in such a case.

    This is probably not a big deal. As far as I know, the only small
    problem is scripts/mod/sumversion.c parses the same file multiple
    times.

    I am fixing this because I plan to reuse *.mod for other purposes,
    where the duplication can be problematic.

    The code change is quite simple. We already use awk to drop duplicated
    lines in modules.order (see cmd_modules_order in the same file).
    I copied the code, but changed RS to use spaces as record separators.

    I also changed the file format to list one object per line.

    Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
    (cherry picked from commit 22f26f21774f838e97921952d8c5c4aab3da2ea4)

Signed-off-by: Joel Slebodnick <jslebodn@redhat.com>
2023-03-24 17:06:53 -04:00
..
.gitignore .gitignore: prefix local generated files with a slash 2021-05-02 00:43:35 +09:00
Makefile scripts/mod: disable LTO for empty.c 2021-01-14 08:21:09 -08:00
devicetable-offsets.c Merge: [EHL] Intel Sensor Hub (ISH): EClite driver enabling 2022-05-25 09:28:12 +02:00
empty.c
file2alias.c bus: mhi: ep: Add uevent support for module autoloading 2022-11-28 12:56:12 +01:00
mk_elfconfig.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
modpost.c kbuild: Fixup the IBT kbuild changes 2023-03-24 17:06:53 -04:00
modpost.h Modules updates for v5.12 2021-02-23 10:15:33 -08:00
sumversion.c kbuild: get rid of duplication in *.mod files 2023-03-24 17:06:53 -04:00