Consider providing an universal way to read (proc macro) dylib metadata. #79239
Labels
A-codegen
Area: Code generation
A-metadata
Area: Crate metadata
A-proc-macros
Area: Procedural macros
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
In EmbarkStudios/rust-gpu#268, I used
rustc_codegen_llvm
's implementation ofget_dylib_metadata
, in order to support proc macros, and also found out thatrustc_codegen_cranelift
uses theobject
crate for itsget_dylib_metadata
.(Both the LLVM and the
object
-based implementation extract the.rustc
section of an.so
,.dll
, etc.)AFAICT, the codegen backend shouldn't really matter, for proc macros specifically, as the proc macro is compiled for the same ("host") platform executing
rustc
, and for which we havedlopen
(or equivalent) support.So if we trust the
object
crate to work for at least proc macros, we can attempt to access the dylib metadata using it (i.e. just likerustc_codegen_cranelift
does), before we ask the codegen backend for a fallback implementation (which could specifically handle non-proc-macro targetdylib
crates).cc @bjorn3 @khyperia @nagisa
The text was updated successfully, but these errors were encountered: