rustc_codegen_cranelift
rustc_codegen_cranelift copied to clipboard
Implement platform specific symbol mangling suppression using \x01
Many platforms have some symbol mangling even for "unmangled" C symbols. For example adding a leading _ or trailing @argcount. LLVM supports suppressing this by prefixing the symbol name with \x01. cg_clif will need to implement this too to support building with -Cpanic=unwind on Windows: https://github.com/rust-lang/rust/blob/2d8651a92761421b0437ffb44ba5670bea5ee1df/library/panic_unwind/src/seh.rs#L213
Removed from the rustup component milestone as that will use a panic_unwind compiled using cg_llvm.
Perhaps the lang team ought to consider whether Rust wants to expose LLVM's \x01 escape code or provide some other means of escaping link names?
Even if the decision is to stick with (and, I guess, document) the \x01 escape, it'd be perfectly reasonable to detect that escape in rustc and lower in some other way to cranelift.
Documenting it or providing another mean of escaping link names are both fine with me. It doesn't help with implementing this in cg_clif though. cranelift_module and cranelift_object currently don't expose any way to implement it. Once they do, an implementation in cg_clif should be trivial no matter how it is implemented.