lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAS5BGwM2CYckhM5J70eCpLunBG6hToR_K604nXgxnHL4w@mail.gmail.com>
Date: Tue, 15 Oct 2024 03:44:34 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: Tamir Duberstein <tamird@...il.com>
Cc: Daniel Gomez <da.gomez@...sung.com>, Fiona Behrens <me@...enk.dev>, 
	Nathan Chancellor <nathan@...nel.org>, Nicolas Schier <nicolas@...sle.eu>, Miguel Ojeda <ojeda@...nel.org>, 
	Alex Gaynor <alex.gaynor@...il.com>, Boqun Feng <boqun.feng@...il.com>, 
	Gary Guo <gary@...yguo.net>, Björn Roy Baron <bjorn3_gh@...tonmail.com>, 
	Benno Lossin <benno.lossin@...ton.me>, Andreas Hindborg <a.hindborg@...nel.org>, 
	Alice Ryhl <aliceryhl@...gle.com>, Trevor Gross <tmgross@...ch.edu>, 
	Vincent Mailhol <mailhol.vincent@...adoo.fr>, Íñigo Huguet <ihuguet@...hat.com>, 
	Danny Lin <danny@...ag0n.dev>, Vegard Nossum <vegard.nossum@...cle.com>, 
	Laurent Pinchart <laurent.pinchart@...asonboard.com>, 
	Thomas Weißschuh <linux@...ssschuh.net>, 
	Kris Van Hees <kris.van.hees@...cle.com>, linux-kernel@...r.kernel.org, 
	linux-kbuild@...r.kernel.org, rust-for-linux@...r.kernel.org
Subject: Re: [PATCH v5] rust: query the compiler for dylib path

On Thu, Oct 10, 2024 at 11:29 PM Tamir Duberstein <tamird@...il.com> wrote:
>
> Rust proc-macro crates are loaded by the compiler at compile-time, so
> are always dynamic libraries; on macOS, these artifacts get a .dylib
> extension rather than .so.
>
> Replace hardcoded paths ending in .so with paths obtained from the
> compiler.
>
> This allows the kernel to build with CONFIG_RUST=y on macOS.
>
> Co-developed-by: Fiona Behrens <me@...enk.dev>
> Signed-off-by: Fiona Behrens <me@...enk.dev>
> Signed-off-by: Tamir Duberstein <tamird@...il.com>
> ---
> V4 -> V5: Added missing `shell` in rust/Makefile.
> V3 -> V4: Added motivation. Added missing Signed-off-by.
> V2 -> V3: Added .strip() to rustc output to remove errant newline.
> V1 -> V2: De-duplicated and sorted imports. Changed Signed-off-by to
> Co-developed-by.
>
>  .gitignore                        |  1 +
>  Makefile                          |  2 +-
>  rust/Makefile                     | 21 ++++++++++++---------
>  scripts/generate_rust_analyzer.py | 15 +++++++++++----
>  4 files changed, 25 insertions(+), 14 deletions(-)
>
> diff --git a/.gitignore b/.gitignore
> index a61e4778d011..088696a6a46a 100644
> --- a/.gitignore
> +++ b/.gitignore
> @@ -22,6 +22,7 @@
>  *.dtb.S
>  *.dtbo.S
>  *.dwo
> +*.dylib
>  *.elf
>  *.gcno
>  *.gcda
> diff --git a/Makefile b/Makefile
> index a9e723cb0596..470e6f20c513 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -1513,7 +1513,7 @@ MRPROPER_FILES += include/config include/generated          \
>                   certs/x509.genkey \
>                   vmlinux-gdb.py \
>                   rpmbuild \
> -                 rust/libmacros.so
> +                 rust/libmacros.so rust/libmacros.dylib
>
>  # clean - Delete most, but leave enough to build external modules
>  #
> diff --git a/rust/Makefile b/rust/Makefile
> index 0856fd6bc610..2e9fd151fce4 100644
> --- a/rust/Makefile
> +++ b/rust/Makefile
> @@ -11,9 +11,6 @@ always-$(CONFIG_RUST) += exports_core_generated.h
>  obj-$(CONFIG_RUST) += helpers/helpers.o
>  CFLAGS_REMOVE_helpers/helpers.o = -Wmissing-prototypes -Wmissing-declarations
>
> -always-$(CONFIG_RUST) += libmacros.so
> -no-clean-files += libmacros.so
> -
>  always-$(CONFIG_RUST) += bindings/bindings_generated.rs bindings/bindings_helpers_generated.rs
>  obj-$(CONFIG_RUST) += alloc.o bindings.o kernel.o
>  always-$(CONFIG_RUST) += exports_alloc_generated.h exports_helpers_generated.h \
> @@ -36,9 +33,15 @@ always-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.c
>  obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated.o
>  obj-$(CONFIG_RUST_KERNEL_DOCTESTS) += doctests_kernel_generated_kunit.o
>
> -# Avoids running `$(RUSTC)` for the sysroot when it may not be available.
> +# Avoids running `$(RUSTC)` when it may not be available.
>  ifdef CONFIG_RUST
>
> +libmacros_name := $(shell $(RUSTC) --print file-names --crate-name macros --crate-type proc-macro - < /dev/null)
> +libmacros_extension := $(patsubst libmacros.%,%,$(libmacros_name))
> +
> +always-$(CONFIG_RUST) += $(libmacros_name)
> +no-clean-files += $(libmacros_name)


This no-clean-files is meaningless and unnecessary.
This line exists inside the "ifdef CONFIG_RUST" ... "endif" block.

no-clean-files is only used by scripts/Makefile.clean,
which does not include include/config/auto.conf.







-- 
Best Regards
Masahiro Yamada

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ