[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231006093941.1151819-1-aliceryhl@google.com>
Date: Fri, 6 Oct 2023 09:39:41 +0000
From: Alice Ryhl <aliceryhl@...gle.com>
To: mmaurer@...gle.com
Cc: a.hindborg@...sung.com, alex.gaynor@...il.com,
aliceryhl@...gle.com, benno.lossin@...ton.me,
bjorn3_gh@...tonmail.com, boqun.feng@...il.com, gary@...yguo.net,
linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev, masahiroy@...nel.org, nathan@...nel.org,
ndesaulniers@...gle.com, nicolas@...sle.eu, ojeda@...nel.org,
rust-for-linux@...r.kernel.org, trix@...hat.com, wedsonaf@...il.com
Subject: [PATCH v4] rust: Respect HOSTCC when linking for host
Matthew Maurer <mmaurer@...gle.com> writes:
> Currently, rustc defaults to invoking `cc`, even if `HOSTCC` is defined,
> resulting in build failures in hermetic environments where `cc` does not
> exist. This includes both hostprogs and proc-macros.
>
> Since we are setting the linker to `HOSTCC`, we set the linker flavor to
> `gcc` explicitly. The linker-flavor selects both which linker to search
> for if the linker is unset, and which kind of linker flags to pass.
> Without this flag, `rustc` would attempt to determine which flags to
> pass based on the name of the binary passed as `HOSTCC`. `gcc` is the
> name of the linker-flavor used by `rustc` for all C compilers, including
> both `gcc` and `clang`.
>
> Signed-off-by: Matthew Maurer <mmaurer@...gle.com>
Tested-by: Alice Ryhl <aliceryhl@...gle.com>
Powered by blists - more mailing lists