Skip to content
Snippets Groups Projects
  1. Mar 03, 2025
    • Kees Cook's avatar
      kbuild: Use -fzero-init-padding-bits=all · 6a5e4863
      Kees Cook authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit dce4aab8441d285b9a78b33753e0bf583c1320ee ]
      
      GCC 15 introduces a regression in "= { 0 }" style initialization of
      unions that Linux has depended on for eliminating uninitialized variable
      contents. GCC does not seem likely to fix it[1], instead suggesting[2]
      that affected projects start using -fzero-init-padding-bits=unions.
      
      To avoid future surprises beyond just the current situation with unions,
      enable -fzero-init-padding-bits=all when available (GCC 15+). This will
      correctly zero padding bits in unions and structs that might have been
      left uninitialized, and will make sure there is no immediate regression
      in union initializations. As seen in the stackinit KUnit selftest union
      cases, which were passing before, were failing under GCC 15:
      
          not ok 18 test_small_start_old_zero
          ok 29 test_small_start_dynamic_partial # SKIP XFAIL uninit bytes: 63
          ok 32 test_small_start_assigned_dynamic_partial # SKIP XFAIL uninit bytes: 63
          ok 67 test_small_start_static_partial # SKIP XFAIL uninit bytes: 63
          ok 70 test_small_start_static_all # SKIP XFAIL uninit bytes: 56
          ok 73 test_small_start_dynamic_all # SKIP XFAIL uninit bytes: 56
          ok 82 test_small_start_assigned_static_partial # SKIP XFAIL uninit bytes: 63
          ok 85 test_small_start_assigned_static_all # SKIP XFAIL uninit bytes: 56
          ok 88 test_small_start_assigned_dynamic_all # SKIP XFAIL uninit bytes: 56
      
      The above all now pass again with -fzero-init-padding-bits=all added.
      
      This also fixes the following cases for struct initialization that had
      been XFAIL until now because there was no compiler support beyond the
      larger "-ftrivial-auto-var-init=zero" option:
      
          ok 38 test_small_hole_static_all # SKIP XFAIL uninit bytes: 3
          ok 39 test_big_hole_static_all # SKIP XFAIL uninit bytes: 124
          ok 40 test_trailing_hole_static_all # SKIP XFAIL uninit bytes: 7
          ok 42 test_small_hole_dynamic_all # SKIP XFAIL uninit bytes: 3
          ok 43 test_big_hole_dynamic_all # SKIP XFAIL uninit bytes: 124
          ok 44 test_trailing_hole_dynamic_all # SKIP XFAIL uninit bytes: 7
          ok 58 test_small_hole_assigned_static_all # SKIP XFAIL uninit bytes: 3
          ok 59 test_big_hole_assigned_static_all # SKIP XFAIL uninit bytes: 124
          ok 60 test_trailing_hole_assigned_static_all # SKIP XFAIL uninit bytes: 7
          ok 62 test_small_hole_assigned_dynamic_all # SKIP XFAIL uninit bytes: 3
          ok 63 test_big_hole_assigned_dynamic_all # SKIP XFAIL uninit bytes: 124
          ok 64 test_trailing_hole_assigned_dynamic_all # SKIP XFAIL uninit bytes: 7
      
      All of the above now pass when built under GCC 15. Tests can be seen
      with:
      
          ./tools/testing/kunit/kunit.py run stackinit --arch=x86_64 \
              --make_option CC=gcc-15
      
      Clang continues to fully initialize these kinds of variables[3] without
      additional flags.
      
      Suggested-by: default avatarJakub Jelinek <jakub@redhat.com>
      Link: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118403 [1]
      Link: https://lore.kernel.org/linux-toolchains/Z0hRrrNU3Q+ro2T7@tucnak/ [2]
      Link: https://github.com/llvm/llvm-project/commit/7a086e1b2dc05f54afae3591614feede727601fa
      
       [3]
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Link: https://lore.kernel.org/r/20250127191031.245214-3-kees@kernel.org
      
      
      Signed-off-by: default avatarKees Cook <kees@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      6a5e4863
    • Masahiro Yamada's avatar
      kbuild: suppress stdout from merge_config for silent builds · 724d75d6
      Masahiro Yamada authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit 1f937a4bcb0472015818f30f4d3c5546d3f09933 ]
      
      merge_config does not respect the Make's -s (--silent) option.
      
      Let's sink the stdout from merge_config for silent builds.
      
      This commit does not cater to the direct invocation of merge_config.sh
      (e.g. arch/mips/Makefile).
      
      Reported-by: default avatarLeon Romanovsky <leon@kernel.org>
      Closes: https://lore.kernel.org/all/e534ce33b0e1060eb85ece8429810f087b034c88.1733234008.git.leonro@nvidia.com/
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarLeon Romanovsky <leon@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      724d75d6
    • Nathan Chancellor's avatar
      scripts/Makefile.extrawarn: Do not show clang's non-kprintf warnings at W=1 · 8147f332
      Nathan Chancellor authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit 738fc998b639407346a9e026514f0562301462cd ]
      
      Clang's -Wformat-overflow and -Wformat-truncation have chosen to check
      '%p' unlike GCC but it does not know about the kernel's pointer
      extensions in lib/vsprintf.c, so the developers split that part of the
      warning out for the kernel to disable because there will always be false
      positives.
      
      Commit 908dd508 ("kbuild: enable -Wformat-truncation on clang") did
      disabled these warnings but only in a block that would be called when
      W=1 was not passed, so they would appear with W=1. Move the disabling of
      the non-kprintf warnings to a block that always runs so that they are
      never seen, regardless of warning level.
      
      Fixes: 908dd508 ("kbuild: enable -Wformat-truncation on clang")
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202501291646.VtwF98qd-lkp@intel.com/
      
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      8147f332
    • Jan Kiszka's avatar
      scripts/gdb: fix aarch64 userspace detection in get_current_task · 4b7ff787
      Jan Kiszka authored and Frieder Schrempf's avatar Frieder Schrempf committed
      commit 4ebc417ef9cb34010a71270421fe320ec5d88aa2 upstream.
      
      At least recent gdb releases (seen with 14.2) return SP_EL0 as signed long
      which lets the right-shift always return 0.
      
      Link: https://lkml.kernel.org/r/dcd2fabc-9131-4b48-8419-6444e2d67454@siemens.com
      
      
      Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
      Cc: Barry Song <baohua@kernel.org>
      Cc: Kieran Bingham <kbingham@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4b7ff787
    • Alice Ryhl's avatar
      x86: rust: set rustc-abi=x86-softfloat on rustc>=1.86.0 · a78d0dcc
      Alice Ryhl authored and Frieder Schrempf's avatar Frieder Schrempf committed
      commit 6273a058383e05465083b535ed9469f2c8a48321 upstream.
      
      When using Rust on the x86 architecture, we are currently using the
      unstable target.json feature to specify the compilation target. Rustc is
      going to change how softfloat is specified in the target.json file on
      x86, thus update generate_rust_target.rs to specify softfloat using the
      new option.
      
      Note that if you enable this parameter with a compiler that does not
      recognize it, then that triggers a warning but it does not break the
      build.
      
      [ For future reference, this solves the following error:
      
              RUSTC L rust/core.o
            error: Error loading target specification: target feature
            `soft-float` is incompatible with the ABI but gets enabled in
            target spec. Run `rustc --print target-list` for a list of
            built-in targets
      
        - Miguel ]
      
      Cc: <stable@vger.kernel.org> # Needed in 6.12.y and 6.13.y only (Rust is pinned in older LTSs).
      Link: https://github.com/rust-lang/rust/pull/136146
      
      
      Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Acked-by: Dave Hansen <dave.hansen@linux.intel.com> # for x86
      Link: https://lore.kernel.org/r/20250203-rustc-1-86-x86-softfloat-v1-1-220a72a5003e@google.com
      
      
      [ Added 6.13.y too to Cc: stable tag and added reasoning to avoid
        over-backporting. - Miguel ]
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a78d0dcc
    • Nathan Chancellor's avatar
      kbuild: Move -Wenum-enum-conversion to W=2 · 260333a5
      Nathan Chancellor authored and Frieder Schrempf's avatar Frieder Schrempf committed
      commit 8f6629c004b193d23612641c3607e785819e97ab upstream.
      
      -Wenum-enum-conversion was strengthened in clang-19 to warn for C, which
      caused the kernel to move it to W=1 in commit 75b5ab13 ("kbuild:
      Move -Wenum-{compare-conditional,enum-conversion} into W=1") because
      there were numerous instances that would break builds with -Werror.
      Unfortunately, this is not a full solution, as more and more developers,
      subsystems, and distributors are building with W=1 as well, so they
      continue to see the numerous instances of this warning.
      
      Since the move to W=1, there have not been many new instances that have
      appeared through various build reports and the ones that have appeared
      seem to be following similar existing patterns, suggesting that most
      instances of this warning will not be real issues. The only alternatives
      for silencing this warning are adding casts (which is generally seen as
      an ugly practice) or refactoring the enums to macro defines or a unified
      enum (which may be undesirable because of type safety in other parts of
      the code).
      
      Move the warning to W=2, where warnings that occur frequently but may be
      relevant should reside.
      
      Cc: stable@vger.kernel.org
      Fixes: 75b5ab13 ("kbuild: Move -Wenum-{compare-conditional,enum-conversion} into W=1")
      Link: https://lore.kernel.org/ZwRA9SOcOjjLJcpi@google.com/
      
      
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      260333a5
    • Parth Pancholi's avatar
      kbuild: switch from lz4c to lz4 for compression · 80c91af6
      Parth Pancholi authored and Frieder Schrempf's avatar Frieder Schrempf committed
      commit e397a603e49cc7c7c113fad9f55a09637f290c34 upstream.
      
      Replace lz4c with lz4 for kernel image compression.
      Although lz4 and lz4c are functionally similar, lz4c has been deprecated
      upstream since 2018. Since as early as Ubuntu 16.04 and Fedora 25, lz4
      and lz4c have been packaged together, making it safe to update the
      requirement from lz4c to lz4.
      
      Consequently, some distributions and build systems, such as OpenEmbedded,
      have fully transitioned to using lz4. OpenEmbedded core adopted this
      change in commit fe167e082cbd ("bitbake.conf: require lz4 instead of
      lz4c"), causing compatibility issues when building the mainline kernel
      in the latest OpenEmbedded environment, as seen in the errors below.
      
      This change also updates the LZ4 compression commands to make it backward
      compatible by replacing stdin and stdout with the '-' option, due to some
      unclear reason, the stdout keyword does not work for lz4 and '-' works for
      both. In addition, this modifies the legacy '-c1' with '-9' which is also
      compatible with both. This fixes the mainline kernel build failures with
      the latest master OpenEmbedded builds associated with the mentioned
      compatibility issues.
      
      LZ4     arch/arm/boot/compressed/piggy_data
      /bin/sh: 1: lz4c: not found
      ...
      ...
      ERROR: oe_runmake failed
      
      Link: https://github.com/lz4/lz4/pull/553
      
      
      Suggested-by: default avatarFrancesco Dolcini <francesco.dolcini@toradex.com>
      Signed-off-by: default avatarParth Pancholi <parth.pancholi@toradex.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Cc: Salvatore Bonaccorso <carnil@debian.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      80c91af6
    • Masahiro Yamada's avatar
      kconfig: fix memory leak in sym_warn_unmet_dep() · c94585db
      Masahiro Yamada authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit a409fc1463d664002ea9bf700ae4674df03de111 ]
      
      The string allocated in sym_warn_unmet_dep() is never freed, leading
      to a memory leak when an unmet dependency is detected.
      
      Fixes: f8f69dc0 ("kconfig: make unmet dependency warnings readable")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarPetr Vorel <pvorel@suse.cz>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c94585db
    • Masahiro Yamada's avatar
      kconfig: fix file name in warnings when loading KCONFIG_DEFCONFIG_LIST · 9dcbac1b
      Masahiro Yamada authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit a314f52a0210730d0d556de76bb7388e76d4597d ]
      
      Most 'make *config' commands use .config as the base configuration file.
      
      When .config does not exist, Kconfig tries to load a file listed in
      KCONFIG_DEFCONFIG_LIST instead.
      
      However, since commit b75b0a81 ("kconfig: change defconfig_list
      option to environment variable"), warning messages have displayed an
      incorrect file name in such cases.
      
      Below is a demonstration using Debian Trixie. While loading
      /boot/config-6.12.9-amd64, the warning messages incorrectly show .config
      as the file name.
      
      With this commit, the correct file name is displayed in warnings.
      
      [Before]
      
        $ rm -f .config
        $ make config
        #
        # using defaults found in /boot/config-6.12.9-amd64
        #
        .config:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT
        .config:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
      
      [After]
      
        $ rm -f .config
        $ make config
        #
        # using defaults found in /boot/config-6.12.9-amd64
        #
        /boot/config-6.12.9-amd64:6804:warning: symbol value 'm' invalid for FB_BACKLIGHT
        /boot/config-6.12.9-amd64:9895:warning: symbol value 'm' invalid for ANDROID_BINDER_IPC
      
      Fixes: b75b0a81 ("kconfig: change defconfig_list option to environment variable")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      9dcbac1b
    • Masahiro Yamada's avatar
      genksyms: fix memory leak when the same symbol is read from *.symref file · c5ff15c1
      Masahiro Yamada authored and Frieder Schrempf's avatar Frieder Schrempf committed
      
      [ Upstream commit be2fa44b5180a1f021efb40c55fdf63c249c3209 ]
      
      When a symbol that is already registered is read again from *.symref
      file, __add_symbol() removes the previous one from the hash table without
      freeing it.
      
      [Test Case]
      
        $ cat foo.c
        #include <linux/export.h>
        void foo(void);
        void foo(void) {}
        EXPORT_SYMBOL(foo);
      
        $ cat foo.symref
        foo void foo ( void )
        foo void foo ( void )
      
      When a symbol is removed from the hash table, it must be freed along
      with its ->name and ->defn members. However, sym->name cannot be freed
      because it is sometimes shared with node->string, but not always. If
      sym->name and node->string share the same memory, free(sym->name) could
      lead to a double-free bug.
      
      To resolve this issue, always assign a strdup'ed string to sym->name.
      
      Fixes: 64e6c1e1 ("genksyms: track symbol checksum changes")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      c5ff15c1
    • Masahiro Yamada's avatar
      genksyms: fix memory leak when the same symbol is added from source · 45cc5665
      Masahiro Yamada authored and Frieder Schrempf's avatar Frieder Schrempf committed
      [ Upstream commit 45c9c4101d3d2fdfa00852274bbebba65fcc3cf2 ]
      
      When a symbol that is already registered is added again, __add_symbol()
      returns without freeing the symbol definition, making it unreachable.
      
      The following test cases demonstrate different memory leak points.
      
      [Test Case 1]
      
      Forward declaration with exactly the same definition
      
        $ cat foo.c
        #include <linux/export.h>
        void foo(void);
        void foo(void) {}
        EXPORT_SYMBOL(foo);
      
      [Test Case 2]
      
      Forward declaration with a different definition (e.g. attribute)
      
        $ cat foo.c
        #include <linux/export.h>
        void foo(void);
        __attribute__((__section__(".ref.text"))) void foo(void) {}
        EXPORT_SYMBOL(foo);
      
      [Test Case 3]
      
      Preserving an overridden symbol (compile with KBUILD_PRESERVE=1)
      
        $ cat foo.c
        #include <linux/export.h>
        void foo(void);
        void foo(void) { }
        EXPORT_SYMBOL(foo);
      
        $ cat foo.symref
        override foo void foo ( int )
      
      The memory leaks in Test Case 1 and 2 have existed since the introduction
      of genksyms into the kernel tree. [1]
      
      The memory leak in Test Case 3 was introduced by commit 5dae9a55
      ("genksyms: allow to ignore symbol checksum changes").
      
      When multiple init_declarators are reduced to an init_declarator_list,
      the decl_spec must be duplicated. Otherwise, the following Test Case 4
      would result in a double-free bug.
      
      [Test Case 4]
      
        $ cat foo.c
        #include <linux/export.h>
      
        extern int foo, bar;
      
        int foo, bar;
        EXPORT_SYMBOL(foo);
      
      In this case, 'foo' and 'bar' share the same decl_spec, 'int'. It must
      be unshared before being passed to add_symbol().
      
      [1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=46bd1da672d66ccd8a639d3c1f8a166048cca608
      
      
      
      Fixes: 5dae9a55 ("genksyms: allow to ignore symbol checksum changes")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      45cc5665
  2. Jan 09, 2025
  3. Dec 14, 2024
  4. Dec 05, 2024
    • Masahiro Yamada's avatar
      modpost: remove incorrect code in do_eisa_entry() · e70c21da
      Masahiro Yamada authored
      
      [ Upstream commit 0c3e091319e4748cb36ac9a50848903dc6f54054 ]
      
      This function contains multiple bugs after the following commits:
      
       - ac551828 ("modpost: i2c aliases need no trailing wildcard")
       - 6543becf ("mod/file2alias: make modalias generation safe for cross compiling")
      
      Commit ac551828 inserted the following code to do_eisa_entry():
      
          else
                  strcat(alias, "*");
      
      This is incorrect because 'alias' is uninitialized. If it is not
      NULL-terminated, strcat() could cause a buffer overrun.
      
      Even if 'alias' happens to be zero-filled, it would output:
      
          MODULE_ALIAS("*");
      
      This would match anything. As a result, the module could be loaded by
      any unrelated uevent from an unrelated subsystem.
      
      Commit ac551828 introduced another bug.            
      
      Prior to that commit, the conditional check was:
      
          if (eisa->sig[0])
      
      This checked if the first character of eisa_device_id::sig was not '\0'.
      
      However, commit ac551828 changed it as follows:
      
          if (sig[0])
      
      sig[0] is NOT the first character of the eisa_device_id::sig. The
      type of 'sig' is 'char (*)[8]', meaning that the type of 'sig[0]' is
      'char [8]' instead of 'char'. 'sig[0]' and 'symval' refer to the same
      address, which never becomes NULL.
      
      The correct conversion would have been:
      
          if ((*sig)[0])
      
      However, this if-conditional was meaningless because the earlier change
      in commit ac551828 was incorrect.
      
      This commit removes the entire incorrect code, which should never have
      been executed.
      
      Fixes: ac551828 ("modpost: i2c aliases need no trailing wildcard")
      Fixes: 6543becf ("mod/file2alias: make modalias generation safe for cross compiling")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      e70c21da
    • Matt Fleming's avatar
      kbuild: deb-pkg: Don't fail if modules.order is missing · 34d321f4
      Matt Fleming authored
      
      [ Upstream commit bcbbf493f2fa6fa1f0832f6b5b4c80a65de242d6 ]
      
      Kernels built without CONFIG_MODULES might still want to create -dbg deb
      packages but install_linux_image_dbg() assumes modules.order always
      exists. This obviously isn't true if no modules were built, so we should
      skip reading modules.order in that case.
      
      Fixes: 16c36f88 ("kbuild: deb-pkg: use build ID instead of debug link for dbg package")
      Signed-off-by: default avatarMatt Fleming <mfleming@cloudflare.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      34d321f4
    • Tamir Duberstein's avatar
      checkpatch: always parse orig_commit in fixes tag · 87e17b13
      Tamir Duberstein authored
      
      [ Upstream commit 2f07b652384969f5d0b317e1daa5f2eb967bc73d ]
      
      Do not require the presence of `$balanced_parens` to get the commit SHA;
      this allows a `Fixes: deadbeef` tag to get a correct suggestion rather
      than a suggestion containing a reference to HEAD.
      
      Given this patch:
      
      : From: Tamir Duberstein <tamird@gmail.com>
      : Subject: Test patch
      : Date: Fri, 25 Oct 2024 19:30:51 -0400
      :
      : This is a test patch.
      :
      : Fixes: bd17e036
      : Signed-off-by: Tamir Duberstein <tamird@gmail.com>
      : --- /dev/null
      : +++ b/new-file
      : @@ -0,0 +1 @@
      : +Test.
      
      Before:
      
      WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: c10a7d25e68f ("Test patch")'
      
      After:
      
      WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: bd17e036 ("checkpatch: warn for non-standard fixes tag style")'
      
      The prior behavior incorrectly suggested the patch's own SHA and title
      line rather than the referenced commit's.  This fixes that.
      
      Ironically this:
      
      Fixes: bd17e036 ("checkpatch: warn for non-standard fixes tag style")
      Signed-off-by: default avatarTamir Duberstein <tamird@gmail.com>
      Cc: Andy Whitcroft <apw@canonical.com>
      Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
      Cc: Joe Perches <joe@perches.com>
      Cc: Louis Peens <louis.peens@corigine.com>
      Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
      Cc: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
      Cc: Philippe Schenker <philippe.schenker@toradex.com>
      Cc: Simon Horman <horms@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      87e17b13
    • Randy Dunlap's avatar
      kernel-doc: allow object-like macros in ReST output · 2d62981c
      Randy Dunlap authored
      
      [ Upstream commit bb8fd09e2811e2386bb40b9f0d3c7dd6e7961a1e ]
      
      output_function_rst() does not handle object-like macros. It presents
      a trailing "()" while output_function_man() handles these macros
      correctly.
      
      Update output_function_rst() to handle object-like macros.
      Don't show the "Parameters" heading if there are no parameters.
      
      For output_function_man(), don't show the "ARGUMENTS" heading if there
      are no parameters.
      
      I have tested this quite a bit with my ad hoc test files for both ReST
      and man format outputs. The generated output looks good.
      
      Fixes: cbb4d3e6 ("scripts/kernel-doc: handle object-like macros")
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Horia Geanta <horia.geanta@freescale.com>
      Tested-by: default avatarVlastimil Babka <vbabka@suse.cz>
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/20241015181107.536894-1-rdunlap@infradead.org
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      2d62981c
    • Chen-Yu Tsai's avatar
      scripts/kernel-doc: Do not track section counter across processed files · 560a2101
      Chen-Yu Tsai authored
      
      [ Upstream commit be9264110e4e874622d588a75daf930539fdf6ea ]
      
      The section counter tracks how many sections of kernel-doc were added.
      The only real use of the counter value is to check if anything was
      actually supposed to be output and give a warning is nothing is
      available.
      
      The current logic of remembering the initial value and then resetting
      the value then when processing each file means that if a file has the
      same number of sections as the previously processed one, a warning is
      incorrectly given.
      
      Fixes: 1da177e4 ("Linux-2.6.12-rc2")
      Signed-off-by: default avatarChen-Yu Tsai <wenst@chromium.org>
      Signed-off-by: default avatarJonathan Corbet <corbet@lwn.net>
      Link: https://lore.kernel.org/r/20241008082905.4005524-1-wenst@chromium.org
      
      
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      560a2101
    • Carlos Llamas's avatar
      Revert "scripts/faddr2line: Check only two symbols when calculating symbol size" · 3773d35c
      Carlos Llamas authored
      
      [ Upstream commit 56ac7bd2c58a4e93d19f0ccb181035d075b315d3 ]
      
      This reverts commit c02904f0.
      
      Such commit assumed that only two symbols are relevant for the symbol
      size calculation. However, this can lead to an incorrect symbol size
      calculation when there are mapping symbols emitted by readelf.
      
      For instance, when feeding 'update_irq_load_avg+0x1c/0x1c4', faddr2line
      might need to process the following readelf lines:
      
       784284: ffffffc0081cca30   428 FUNC    GLOBAL DEFAULT     2 update_irq_load_avg
        87319: ffffffc0081ccb0c     0 NOTYPE  LOCAL  DEFAULT     2 $x.62522
        87321: ffffffc0081ccbdc     0 NOTYPE  LOCAL  DEFAULT     2 $x.62524
        87323: ffffffc0081ccbe0     0 NOTYPE  LOCAL  DEFAULT     2 $x.62526
        87325: ffffffc0081ccbe4     0 NOTYPE  LOCAL  DEFAULT     2 $x.62528
        87327: ffffffc0081ccbe8     0 NOTYPE  LOCAL  DEFAULT     2 $x.62530
        87329: ffffffc0081ccbec     0 NOTYPE  LOCAL  DEFAULT     2 $x.62532
        87331: ffffffc0081ccbf0     0 NOTYPE  LOCAL  DEFAULT     2 $x.62534
        87332: ffffffc0081ccbf4     0 NOTYPE  LOCAL  DEFAULT     2 $x.62535
       783403: ffffffc0081ccbf4   424 FUNC    GLOBAL DEFAULT     2 sched_pelt_multiplier
      
      The symbol size of 'update_irq_load_avg' should be calculated with the
      address of 'sched_pelt_multiplier', after skipping the mapping symbols
      seen in between. However, the offending commit cuts the list short and
      faddr2line incorrectly assumes 'update_irq_load_avg' is the last symbol
      in the section, resulting in:
      
        $ scripts/faddr2line vmlinux update_irq_load_avg+0x1c/0x1c4
        skipping update_irq_load_avg address at 0xffffffc0081cca4c due to size mismatch (0x1c4 != 0x3ff9a59988)
        no match for update_irq_load_avg+0x1c/0x1c4
      
      After reverting the commit the issue is resolved:
      
        $ scripts/faddr2line vmlinux update_irq_load_avg+0x1c/0x1c4
        update_irq_load_avg+0x1c/0x1c4:
        cpu_of at kernel/sched/sched.h:1109
        (inlined by) update_irq_load_avg at kernel/sched/pelt.c:481
      
      Fixes: c02904f0 ("scripts/faddr2line: Check only two symbols when calculating symbol size")
      Signed-off-by: default avatarCarlos Llamas <cmllamas@google.com>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Acked-by: default avatarBrian Johannesmeyer <bjohannesmeyer@gmail.com>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
      3773d35c
  5. Nov 03, 2024
    • Masahiro Yamada's avatar
      modpost: fix input MODULE_DEVICE_TABLE() built for 64-bit on 32-bit host · 77dc55a9
      Masahiro Yamada authored
      
      When building a 64-bit kernel on a 32-bit build host, incorrect
      input MODULE_ALIAS() entries may be generated.
      
      For example, when compiling a 64-bit kernel with CONFIG_INPUT_MOUSEDEV=m
      on a 64-bit build machine, you will get the correct output:
      
        $ grep MODULE_ALIAS drivers/input/mousedev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*110,*r*0,*1,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*r*8,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*14A,*r*a*0,*1,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*145,*r*a*0,*1,*18,*1C,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*110,*r*a*0,*1,*m*l*s*f*w*");
      
      However, building the same kernel on a 32-bit machine results in
      incorrect output:
      
        $ grep MODULE_ALIAS drivers/input/mousedev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*110,*130,*r*0,*1,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*2,*k*r*8,*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*14A,*16A,*r*a*0,*1,*20,*21,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*145,*165,*r*a*0,*1,*18,*1C,*20,*21,*38,*3C,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*3,*k*110,*130,*r*a*0,*1,*20,*21,*m*l*s*f*w*");
      
      A similar issue occurs with CONFIG_INPUT_JOYDEV=m. On a 64-bit build
      machine, the output is:
      
        $ grep MODULE_ALIAS drivers/input/joydev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*0,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*2,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*8,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*6,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*120,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*130,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*2C0,*r*a*m*l*s*f*w*");
      
      However, on a 32-bit machine, the output is incorrect:
      
        $ grep MODULE_ALIAS drivers/input/joydev.mod.c
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*0,*20,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*2,*22,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*8,*28,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*3,*k*r*a*6,*26,*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*11F,*13F,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*11F,*13F,*r*a*m*l*s*f*w*");
        MODULE_ALIAS("input:b*v*p*e*-e*1,*k*2C0,*2E0,*r*a*m*l*s*f*w*");
      
      When building a 64-bit kernel, BITS_PER_LONG is defined as 64. However,
      on a 32-bit build machine, the constant 1L is a signed 32-bit value.
      Left-shifting it beyond 32 bits causes wraparound, and shifting by 31
      or 63 bits makes it a negative value.
      
      The fix in commit e0e92632 ("[PATCH] PATCH: 1 line 2.6.18 bugfix:
      modpost-64bit-fix.patch") is incorrect; it only addresses cases where
      a 64-bit kernel is built on a 64-bit build machine, overlooking cases
      on a 32-bit build machine.
      
      Using 1ULL ensures a 64-bit width on both 32-bit and 64-bit machines,
      avoiding the wraparound issue.
      
      Fixes: e0e92632 ("[PATCH] PATCH: 1 line 2.6.18 bugfix: modpost-64bit-fix.patch")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      77dc55a9
    • Masahiro Yamada's avatar
      modpost: fix acpi MODULE_DEVICE_TABLE built with mismatched endianness · 2e766a1f
      Masahiro Yamada authored
      
      When CONFIG_SATA_AHCI_PLATFORM=m, modpost outputs incorect acpi
      MODULE_ALIAS() if the endianness of the target and the build machine
      do not match.
      
      When the endianness of the target kernel and the build machine match,
      the output is correct:
      
        $ grep 'MODULE_ALIAS("acpi' drivers/ata/ahci_platform.mod.c
        MODULE_ALIAS("acpi*:APMC0D33:*");
        MODULE_ALIAS("acpi*:010601:*");
      
      However, when building a little-endian kernel on a big-endian machine
      (or vice versa), the output is incorrect:
      
        $ grep 'MODULE_ALIAS("acpi' drivers/ata/ahci_platform.mod.c
        MODULE_ALIAS("acpi*:APMC0D33:*");
        MODULE_ALIAS("acpi*:0601??:*");
      
      The 'cls' and 'cls_msk' fields are 32-bit.
      
      DEF_FIELD() must be used instead of DEF_FIELD_ADDR() to correctly handle
      endianness of these 32-bit fields.
      
      The check 'if (cls)' was unnecessary; it never became NULL, as it was
      the pointer to 'symval' plus the offset to the 'cls' field.
      
      Fixes: 26095a01 ("ACPI / scan: Add support for ACPI _CLS device matching")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      2e766a1f
  6. Oct 31, 2024
    • Masahiro Yamada's avatar
      kconfig: show sub-menu entries even if the prompt is hidden · d01661e1
      Masahiro Yamada authored
      
      Since commit f79dc03f ("kconfig: refactor choice value
      calculation"), when EXPERT is disabled, nothing within the "if INPUT"
      ... "endif" block in drivers/input/Kconfig is displayed. This issue
      affects all command-line interfaces and GUI frontends.
      
      The prompt for INPUT is hidden when EXPERT is disabled. Previously,
      menu_is_visible() returned true in this case; however, it now returns
      false, resulting in all sub-menu entries being skipped.
      
      Here is a simplified test case illustrating the issue:
      
          config A
                 bool "A" if X
                 default y
      
          config B
                 bool "B"
                 depends on A
      
      When X is disabled, A becomes unconfigurable and is forced to y.
      B should be displayed, as its dependency is met.
      
      This commit restores the necessary code, so menu_is_visible() functions
      as it did previously.
      
      Fixes: f79dc03f ("kconfig: refactor choice value calculation")
      Reported-by: default avatarEdmund Raile <edmund.raile@proton.me>
      Closes: https://lore.kernel.org/all/5fd0dfc7ff171aa74352e638c276069a5f2e888d.camel@proton.me/
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      d01661e1
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: add pkg.linux-upstream.nokerneldbg build profile · 2ad7126c
      Masahiro Yamada authored
      
      The Debian kernel supports the pkg.linux.nokerneldbg build profile.
      
      The debug package tends to become huge, and you may not want to build
      it even when CONFIG_DEBUG_INFO is enabled.
      
      This commit introduces a similar profile for the upstream kernel.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      2ad7126c
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: add pkg.linux-upstream.nokernelheaders build profile · e2c31822
      Masahiro Yamada authored
      
      Since commit f1d87664 ("kbuild: cross-compile linux-headers package
      when possible"), 'make bindeb-pkg' may attempt to cross-compile the
      linux-headers package, but it fails under certain circumstances.
      
      For example, when CONFIG_MODULE_SIG_FORMAT is enabled on Debian, the
      following command fails:
      
        $ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
            [ snip ]
        Rebuilding host programs with aarch64-linux-gnu-gcc...
          HOSTCC  debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/kallsyms
          HOSTCC  debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sorttable
          HOSTCC  debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/asn1_compiler
          HOSTCC  debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file
        In file included from /usr/include/openssl/opensslv.h:109,
                         from debian/linux-headers-6.12.0-rc4/usr/src/linux-headers-6.12.0-rc4/scripts/sign-file.c:25:
        /usr/include/openssl/macros.h:14:10: fatal error: openssl/opensslconf.h: No such file or directory
           14 | #include <openssl/opensslconf.h>
              |          ^~~~~~~~~~~~~~~~~~~~~~~
        compilation terminated.
      
      This commit adds a new profile, pkg.linux-upstream.nokernelheaders, to
      guard the linux-headers package.
      
      There are two options to fix the above issue.
      
      Option 1: Set the pkg.linux-upstream.nokernelheaders build profile
      
        $ DEB_BUILD_PROFILES=pkg.linux-upstream.nokernelheaders \
          make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- bindeb-pkg
      
      This skips the building of the linux-headers package.
      
      Option 2: Install the necessary build dependencies
      
      If you want to cross-compile the linux-headers package, you need to
      install additional packages.
      
      For example, on Debian, the packages necessary for cross-compiling it
      to arm64 can be installed with the following commands:
      
        # dpkg --add-architecture arm64
        # apt update
        # apt install gcc-aarch64-linux-gnu libssl-dev:arm64
      
      Fixes: f1d87664 ("kbuild: cross-compile linux-headers package when possible")
      Reported-by: default avatarRon Economos <re@w6rz.net>
      Closes: https://lore.kernel.org/all/b3d4f49e-7ddb-29ba-0967-689232329b53@w6rz.net/
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Tested-by: default avatarRon Economos <re@w6rz.net>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      e2c31822
    • Masahiro Yamada's avatar
      kbuild: rpm-pkg: disable kernel-devel package when cross-compiling · cb08a026
      Masahiro Yamada authored
      
      Since commit f1d87664 ("kbuild: cross-compile linux-headers package
      when possible"), 'make binrpm-pkg' may attempt to cross-compile the
      kernel-devel package, but it fails under certain circumstances.
      
      For example, when CONFIG_MODULE_SIG_FORMAT is enabled on openSUSE
      Tumbleweed, the following command fails:
      
        $ make ARCH=arm64 CROSS_COMPILE=aarch64-suse-linux- binrpm-pkg
            [ snip ]
        Rebuilding host programs with aarch64-suse-linux-gcc...
          HOSTCC  /home/masahiro/ref/linux/rpmbuild/BUILDROOT/kernel-6.12.0_rc4-1.aarch64/usr/src/kernels/6.12.0-rc4/scripts/kallsyms
          HOSTCC  /home/masahiro/ref/linux/rpmbuild/BUILDROOT/kernel-6.12.0_rc4-1.aarch64/usr/src/kernels/6.12.0-rc4/scripts/sorttable
          HOSTCC  /home/masahiro/ref/linux/rpmbuild/BUILDROOT/kernel-6.12.0_rc4-1.aarch64/usr/src/kernels/6.12.0-rc4/scripts/asn1_compiler
          HOSTCC  /home/masahiro/ref/linux/rpmbuild/BUILDROOT/kernel-6.12.0_rc4-1.aarch64/usr/src/kernels/6.12.0-rc4/scripts/sign-file
        /home/masahiro/ref/linux/rpmbuild/BUILDROOT/kernel-6.12.0_rc4-1.aarch64/usr/src/kernels/6.12.0-rc4/scripts/sign-file.c:25:10: fatal error: openssl/opensslv.h: No such file or directory
           25 | #include <openssl/opensslv.h>
              |          ^~~~~~~~~~~~~~~~~~~~
        compilation terminated.
      
      I believe this issue is less common on Fedora because the disto's cross-
      compilier cannot link user-space programs. Hence, CONFIG_CC_CAN_LINK is
      unset.
      
      On Fedora 40, the package information explains this limitation clearly:
      
        $ dnf info gcc-aarch64-linux-gnu
            [ snip ]
        Description  : Cross-build GNU C compiler.
                     :
                     : Only building kernels is currently supported.  Support for cross-building
                     : user space programs is not currently provided as that would massively multiply
                     : the number of packages.
      
      Anyway, cross-compiling RPM packages is somewhat challenging.
      
      This commit disables the kernel-devel package when cross-compiling
      because I did not come up with a better solution.
      
      Fixes: f1d87664 ("kbuild: cross-compile linux-headers package when possible")
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      cb08a026
  7. Oct 27, 2024
    • Miguel Ojeda's avatar
      kbuild: rust: avoid errors with old `rustc`s without LLVM patch version · c38a04ec
      Miguel Ojeda authored
      
      Some old versions of `rustc` did not report the LLVM version without
      the patch version, e.g.:
      
          $ rustc --version --verbose
          rustc 1.48.0 (7eac88abb 2020-11-16)
          binary: rustc
          commit-hash: 7eac88abb2e57e752f3302f02be5f3ce3d7adfb4
          commit-date: 2020-11-16
          host: x86_64-unknown-linux-gnu
          release: 1.48.0
          LLVM version: 11.0
      
      Which would make the new `scripts/rustc-llvm-version.sh` fail and,
      in turn, the build:
      
          $ make LLVM=1
            SYNC    include/config/auto.conf.cmd
          ./scripts/rustc-llvm-version.sh: 13: arithmetic expression: expecting primary: "10000 * 10 + 100 * 0 + "
          init/Kconfig:83: syntax error
          init/Kconfig:83: invalid statement
          make[3]: *** [scripts/kconfig/Makefile:85: syncconfig] Error 1
          make[2]: *** [Makefile:679: syncconfig] Error 2
          make[1]: *** [/home/cam/linux/Makefile:780: include/config/auto.conf.cmd] Error 2
          make: *** [Makefile:224: __sub-make] Error 2
      
      Since we do not need to support such binaries, we can avoid adding logic
      for computing `rustc`'s LLVM version for those old binaries.
      
      Thus, instead, just make the match stricter.
      
      Other `rustc` binaries (even newer) did not report the LLVM version at
      all, but that was fine, since it would not match "LLVM", e.g.:
      
          $ rustc --version --verbose
          rustc 1.49.0 (e1884a8e3 2020-12-29)
          binary: rustc
          commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
          commit-date: 2020-12-29
          host: x86_64-unknown-linux-gnu
          release: 1.49.0
      
      Cc: Thorsten Leemhuis <regressions@leemhuis.info>
      Cc: Gary Guo <gary@garyguo.net>
      Reported-by: default avatarCameron MacPherson <cameron.macpherson@gmail.com>
      Closes: https://bugzilla.kernel.org/show_bug.cgi?id=219423
      
      
      Fixes: af0121c2 ("kbuild: rust: add `CONFIG_RUSTC_LLVM_VERSION`")
      Tested-by: default avatarCameron MacPherson <cameron.macpherson@gmail.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
      Link: https://lore.kernel.org/r/20241027145636.416030-1-ojeda@kernel.org
      
      
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      c38a04ec
  8. Oct 23, 2024
  9. Oct 13, 2024
  10. Oct 10, 2024
    • Alice Ryhl's avatar
      kbuild: fix issues with rustc-option · e72a076c
      Alice Ryhl authored
      Fix a few different compiler errors that cause rustc-option to give
      wrong results.
      
      If KBUILD_RUSTFLAGS or the flags being tested contain any -Z flags, then
      the error below is generated. The RUSTC_BOOTSTRAP environment variable
      is added to fix this error.
      
      	error: the option `Z` is only accepted on the nightly compiler
      	help: consider switching to a nightly toolchain: `rustup default nightly`
      	note: selecting a toolchain with `+toolchain` arguments require a rustup proxy;
      	      see <https://rust-lang.github.io/rustup/concepts/index.html>
      	note: for more information about Rust's stability policy, see
      	      <https://doc.rust-lang.org/book/appendix-07-nightly-rust.html#unstable-features
      
      >
      	error: 1 nightly option were parsed
      
      Note that RUSTC_BOOTSTRAP is also defined in the top-level Makefile,
      but Make-exported variables are unfortunately *not* inherited. That said,
      this is changing as of commit 98da874c4303 ("[SV 10593] Export variables
      to $(shell ...) commands"), which is part of Make 4.4.
      
      The probe may also fail with the error message below. To fix it,
      the /dev/null argument is replaced with a file containing the crate
      attribute #![no_core]. The #![no_core] attribute ensures that rustc does
      not look for the standard library. It's not possible to instead supply
      a standard library (i.e. `core`) to rustc, as we need `rustc-option`
      before the Rust standard library is compiled.
      
      	error[E0463]: can't find crate for `std`
      	  |
      	  = note: the `aarch64-unknown-none` target may not be installed
      	  = help: consider downloading the target with `rustup target add aarch64-unknown-none`
      	  = help: consider building the standard library from source with `cargo build -Zbuild-std`
      
      The -o and --out-dir parameters are altered to fix this warning:
      
      	warning: ignoring --out-dir flag due to -o flag
      
      The --sysroot flag is provided as we would otherwise require it to be
      present in KBUILD_RUSTFLAGS. The --emit=obj flag is used to write the
      resulting object file to /dev/null instead of writing it to a file
      in $(TMPOUT).
      
      I verified that the Kconfig version of rustc-option doesn't have the
      same issues.
      
      Fixes: c4229743 ("kbuild: rust: Define probing macros for rustc")
      Co-developed-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      Signed-off-by: default avatarAlice Ryhl <aliceryhl@google.com>
      Acked-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Link: https://lore.kernel.org/r/20241009-rustc-option-bootstrap-v3-1-5fa0d520efba@google.com
      
      
      [ Reworded as discussed in the list. - Miguel ]
      Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
      e72a076c
  11. Oct 09, 2024
  12. Oct 06, 2024
  13. Oct 02, 2024
  14. Oct 01, 2024
Loading