Description
This is a tracking issue for the RFC "Rust Symbol Mangling (v0)" (rust-lang/rfcs#2603).
Current status:
Since #90128, you can control the mangling scheme with -C symbol-mangling-version
, which can be:
legacy
: the older mangling version, still the default currently- explicitly specifying this is unstable-only and also requires
-Z unstable-options
(to allow for eventual removal afterv0
becomes the default)
- explicitly specifying this is unstable-only and also requires
v0
: the new RFC mangling version, as implemented by Introduce Rust symbol mangling scheme. #57967
(Before #90128, this flag was the nightly-only -Z symbol-mangling-version
)
To test the new mangling, set RUSTFLAGS=-Csymbol-mangling-version=v0
(or change rustflags
in .cargo/config.toml
). Please note that only symbols from crates built with that flag will use the new mangling, and that tool support (e.g. debuggers) will be limited initially, until everything is upstreamed. However, RUST_BACKTRACE
and rustfilt
should work out of the box with either mangling version.
Steps:
- Implement the RFC (Introduce Rust symbol mangling scheme. #57967 + Support demangling the new Rust mangling scheme (v0). rustc-demangle#23)
- Upstream C implementation of the demangler to:
-
binutils
/gdb
(GNUlibiberty
)- [PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
committed as gcc-mirror/gcc@979526c - [PATCH] Simplify and generalize rust-demangle's unescaping logic.
committed as gcc-mirror/gcc@42bf58b - [PATCH] Remove some restrictions from rust-demangle.
committed as gcc-mirror/gcc@e1cb00d - [PATCH] Refactor rust-demangle to be independent of C++ demangling.
(original submission) committed as gcc-mirror/gcc@32fc371 - [PATCH] Support the new ("v0") mangling scheme in rust-demangle.
(original submission) committed as gcc-mirror/gcc@8409649
- [PATCH] Move rust_{is_mangled,demangle_sym} to a private libiberty header.
- Linux
perf
(throughbinutils 2.36
and/orlibiberty 11.0
, or later versions - may vary between distros) -
valgrind
-
- Implement demangling support in LLVM, including lldb, lld, llvm-objdump, llvm-nm, llvm-symbolizer, llvm-cxxfilt
- Resolve issue around rustc generating invalid symbol names (v0 mangled symbol doesn't match specification nor can it be demangled with rustfilt or c++filt #83611)
- Adjust documentation (see instructions on rustc-guide)
- Stabilization PR (see instructions on rustc-guide)
Unresolved questions:
- Punycode vs UTF-8, some prior discussion in Ident mangling and unicode. #7539
- Encoding parameter types for function symbols
Desired availability of tooling:
Linux:
- Tools: binutils, gdb, lldb, perf, valgrind
Distro | Has versions of all tools with support? |
---|---|
Debian (latest stable) | ? |
Arch | ? |
Ubuntu (latest release) | ? |
Ubuntu (latest LTS) | ? |
Fedora (latest release) | ? |
Alpine (latest release) | ? |
Windows:
Windows does not have support for demangling either legacy or v0 Rust symbols and requires debuginfo to load the appropriate function name. As such, no special support is required.
macOS:
More investigation is needed to determine to what extent macOS system tools already support Rust v0 mangling.