[PATCH] libiberty rust-demangle, ignore .suffix
Eduard-Mihai Burtescu
eddyb@lyken.rs
Thu Dec 2 17:35:17 GMT 2021
On Thu, Dec 2, 2021, at 19:17, Mark Wielaard wrote:
> Rust v0 symbols can have a .suffix because if compiler transformations.
For some context, the suffix comes from LLVM (I believe as part of its LTO).
If this were a semantic part of a Rust symbol, it would have an encoding within v0 (as we already do for e.g. shims).
That also means that for consistency, suffixes like these should be handled uniformly for both v0 and legacy (as rustc-demangle does), since LLVM doesn't distinguish.
You may even be able to get Clang to generate C++ mangled symbols with ".llvm." suffixes, with enough application of LTO.
This is not unlike GCC ".clone" suffixes, AFAIK.
Sadly I don't think there's a way to handle both as "outside the symbol", without hardcoding ".llvm." in the implementation.
I don't recall the libiberty demangling API having any provisions for the demangler deciding that a mangled symbol "stops early", which would maybe allow for a more general solution.
Despite all that, if it helps in practice, I would still not mind this patch landing in its current form, I just wanted to share my perspective on the larger issue.
Thanks,
- Eddy B.
More information about the Gcc-patches
mailing list