summaryrefslogtreecommitdiff
path: root/.gitignore
diff options
context:
space:
mode:
authorTamir Duberstein <tamird@gmail.com>2024-12-16 10:54:22 -0500
committerMiguel Ojeda <ojeda@kernel.org>2025-01-10 01:01:24 +0100
commit0730422bced5e8325fb6806d9a80bb10673588e6 (patch)
treea6144169c90f1f755b5ec0b282c6283ede0619a8 /.gitignore
parent4401565fe92be6ee54a68ea58d80a4076007d5eb (diff)
rust: use host dylib naming convention to support macOS
Because the `macros` crate exposes procedural macros, it must be compiled as a dynamic library (so it can be loaded by the compiler at compile-time). Before this change the resulting artifact was always named `libmacros.so`, which works on hosts where this matches the naming convention for dynamic libraries. However the proper name on macOS would be `libmacros.dylib`. This turns out to matter even when the dependency is passed with a path (`--extern macros=path/to/libmacros.so` rather than `--extern macros`) because rustc uses the file name to infer the type of the library (see link). This is because there's no way to specify both the path to and the type of the external library via CLI flags. The compiler could speculatively parse the file to determine its type, but it does not do so today. This means that libraries that match neither rustc's naming convention for static libraries nor the platform's naming convention for dynamic libraries are *rejected*. The only solution I've found is to follow the host platform's naming convention. This patch does that by querying the compiler to determine the appropriate name for the artifact. This allows the kernel to build with CONFIG_RUST=y on macOS. Link: https://github.com/rust-lang/rust/blob/d829780/compiler/rustc_metadata/src/locator.rs#L728-L752 Tested-by: Daniel Gomez <da.gomez@samsung.com> Co-developed-by: Fiona Behrens <me@kloenk.dev> Signed-off-by: Fiona Behrens <me@kloenk.dev> Signed-off-by: Tamir Duberstein <tamird@gmail.com> Tested-by: Andreas Hindborg <a.hindborg@kernel.org> Link: https://lore.kernel.org/r/20241216-b4-dylib-host-macos-v7-1-cfc507681447@gmail.com [ Added `MAKEFLAGS=`s to avoid jobserver warnings. Removed space. Reworded title. - Miguel ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org>
Diffstat (limited to '.gitignore')
-rw-r--r--.gitignore1
1 files changed, 1 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index 6839cf84acda..5937c74d3dc1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,6 +22,7 @@
*.dtb.S
*.dtbo.S
*.dwo
+*.dylib
*.elf
*.gcno
*.gcda