Re: [PATCH] rust: query the compiler for dylib path

Miguel Ojeda
2024-10-14T19:09:11Z

On Mon, Oct 14, 2024 at 8:46 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> rustc ignores --emit=link=rust/libmacro.so
> and produces rust/libmacro.dylib.
>
> Is this a bug in rustc?

Hmm... From a quick test in Linux and macOS (in a GitHub runner):

uname
echo | rustc --crate-type=proc-macro --emit=link=a.so -
echo | rustc --crate-type=proc-macro --emit=link=b.dylib -
file a.so
file b.dylib

gives:

Darwin
a.so: Mach-O 64-bit dynamically linked shared library arm64
b.dylib: Mach-O 64-bit dynamically linked shared library arm64

Linux
a.so: ELF 64-bit LSB shared object, x86-64, version 1...
b.dylib: ELF 64-bit LSB shared object, x86-64, version 1...

Cheers,
Miguel