Add vendor-specific suffixes to v0 mangling RFC 2603 by lqd · Pull Request #3224...
source link: https://github.com/rust-lang/rfcs/pull/3224
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Conversation
This PR updates v0 mangling to add an Itanium ABI-like vendor-specific suffix to symbols.
This already happens in practice (e.g. with LLVM LTO to ensure a name is globally unique) and the demanglers following the spec strictly can't handle these symbols. This PR makes them officially part of the spec.
The vendor-specific suffix is optional and doesn't change semantics: it is IMO safe to ignore in the vast majority of cases.
Improvements to the wording and description would be welcome. Opening the PR for possible discussion at today's t-compiler meeting, and possible FCP later.
This comment has been hidden.
changed the title Add vendor-specific suffixes to v0 mangling RFC 2063
Add vendor-specific suffixes to v0 mangling RFC 2603
Fixed
So I was talking to @lqd about my confusion around the Itanium ABI mangling not having such a general mechanism, and @lqd found that it was added in itanium-cxx-abi/cxx-abi#36, relatively recently!
Especially if someone doesn't find that repo, they're likely reading outdated versions without vendor suffixes.
The GNU demangler (in libiberty
and used by e.g. c++filt
) are not complying with it, they only handle the GCC .clone
suffix
Oh, wow, I was wrong, c++filt
will happily demangle a path (like _ZN3foo3barE
into foo::bar
), i.e. without a function signature, but they consider the vendor suffix part of the signature, so those don't get demangled without the signature (also, they kept their "clone" terminology even with other suffixes):
$ c++filt _ZN3foo3barE _ZN3foo3barEv _ZN3foo3barE.llvm.123 _ZN3foo3barEv.llvm.123 foo::bar foo::bar() _ZN3foo3barE.llvm.123 foo::bar() [clone .llvm.123]
I think it was a bad idea for this to be "nested" in a C++ symbol, because you then get weird stuff like that, and ideally it could be handled uniformly for every symbol name (after all, LLVM adds its suffixes without knowing about the mangling of the original symbol name, be it C++, Rust, unmangled, some other thing, etc.).
But specifying it in the RFC won't hurt, I suppose.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
No one assigned
None yet
No milestone
Successfully merging this pull request may close these issues.
None yet
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK