Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make section names plural #1113

Closed
wants to merge 11 commits into from

Commits on Sep 4, 2024

  1. kbuild: rust: add CONFIG_RUSTC_VERSION

    Now that we support several Rust versions, introduce
    `CONFIG_RUSTC_VERSION` so that it can be used in Kconfig to enable and
    disable configuration options based on the `rustc` version.
    
    The approach taken resembles `pahole`'s -- see commit 613fe16
    ("kbuild: Add CONFIG_PAHOLE_VERSION"), i.e. a simple version parsing
    without trying to identify several kinds of compilers, since so far
    there is only one (`rustc`).
    
    However, unlike `pahole`'s, we also print a zero if executing failed for
    any reason, rather than checking if the command is found and executable
    (which still leaves things like a file that exists and is executable,
    but e.g. is built for another platform [1]). An equivalent approach to
    the one here was also submitted for `pahole` [2].
    
    Link: https://lore.kernel.org/rust-for-linux/CANiq72=4vX_tJMJLE6e+bg7ZECHkS-AQpm8GBzuK75G1EB7+Nw@mail.gmail.com/ [1]
    Link: https://lore.kernel.org/linux-kbuild/20240728125527.690726-1-ojeda@kernel.org/ [2]
    Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
    Tested-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://lore.kernel.org/r/20240902165535.1101978-2-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    ojeda committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    6147b82 View commit details
    Browse the repository at this point in the history
  2. kbuild: rust: re-run Kconfig if the version text changes

    Re-run Kconfig if we detect the Rust compiler has changed via the version
    text, like it is done for C.
    
    Unlike C, and unlike `RUSTC_VERSION`, the `RUSTC_VERSION_TEXT` is kept
    under `depends on RUST`, since it should not be needed unless `RUST`
    is enabled.
    
    Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
    Tested-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://lore.kernel.org/r/20240902165535.1101978-3-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    ojeda committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    d44b023 View commit details
    Browse the repository at this point in the history
  3. kbuild: rust: rebuild if the version text changes

    Now that `RUSTC_VERSION_TEXT` exists, use it to rebuild `core` when the
    version text changes (which in turn will trigger a rebuild of all the
    kernel Rust code).
    
    This also applies to proc macros (which only work with the `rustc` that
    compiled them), via the already existing dependency on `core.o`. That
    is cleaned up in the next commit.
    
    However, this does not cover host programs written in Rust, which is
    the same case in the C side.
    
    This is accomplished by referencing directly the generated file, instead
    of using the `fixdep` header trick, since we cannot change the Rust
    standard library sources. This is not too much of a burden, since it
    only needs to be done for `core`.
    
    Tested-by: Alice Ryhl <aliceryhl@google.com>
    Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
    Link: https://lore.kernel.org/r/20240902165535.1101978-4-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    ojeda committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    e960054 View commit details
    Browse the repository at this point in the history
  4. kbuild: rust: replace proc macros dependency on core.o with the ver…

    …sion text
    
    With the `RUSTC_VERSION_TEXT` rebuild support in place, now proc macros
    can depend on that instead of `core.o`.
    
    This means that both the `core` and `macros` crates can be built in
    parallel, and that touching `core.o` does not trigger a rebuild of the
    proc macros.
    
    This could be accomplished using the same approach as for `core`
    (i.e. depending directly on `include/config/RUSTC_VERSION_TEXT`). However,
    that is considered an implementation detail [1], and thus it is best
    to avoid it. Instead, let fixdep find a string that we explicitly
    write down in the source code for this purpose (like it is done for
    `include/linux/compiler-version.h`), which we can easily do (unlike for
    `core`) since this is our own source code.
    
    Suggested-by: Masahiro Yamada <masahiroy@kernel.org>
    Link: https://lore.kernel.org/rust-for-linux/CAK7LNAQBG0nDupXSgAAk-6nOqeqGVkr3H1RjYaqRJ1OxmLm6xA@mail.gmail.com/ [1]
    Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
    Tested-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://lore.kernel.org/r/20240902165535.1101978-5-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    ojeda committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    2e17c2d View commit details
    Browse the repository at this point in the history
  5. docs: rust: include other expressions in conditional compilation section

    Expand the conditional compilation section to explain how to support
    other expressions, such as testing whether `RUSTC_VERSION` is at least
    a given version, which requires a numerical comparison that Rust's `cfg`
    predicates do not support (yet?).
    
    Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
    Tested-by: Alice Ryhl <aliceryhl@google.com>
    Link: https://lore.kernel.org/r/20240902165535.1101978-7-ojeda@kernel.org
    Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
    ojeda committed Sep 4, 2024
    Configuration menu
    Copy the full SHA
    77e1dd1 View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2024

  1. make section names plural

    paddymills committed Sep 5, 2024
    Configuration menu
    Copy the full SHA
    4beb37b View commit details
    Browse the repository at this point in the history

Commits on Sep 6, 2024

  1. Configuration menu
    Copy the full SHA
    583a7b1 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    3718054 View commit details
    Browse the repository at this point in the history
  3. Revert "fix whitespace, add missed headers"

    This reverts commit 3718054.
    paddymills committed Sep 6, 2024
    Configuration menu
    Copy the full SHA
    836bb81 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    161d428 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    677bb2c View commit details
    Browse the repository at this point in the history