-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce Rust symbol mangling scheme. #57967
Conversation
@bors try |
Introduce Rust symbol mangling scheme. This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 - but with some differences, see rust-lang/rfcs#2603 (comment) for details. The demangling implementation PR is rust-lang/rustc-demangle#23 (this PR already uses it via a git dependency, to allow testing). Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel. <hr/> *Notes for reviewers*: * only the last 4 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand) * the "TEMPORARY" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater * there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
💥 Test timed out |
So that's probably because the checking is quite thorough (therefore a bit slow) - I don't want to compromise on that, is there any way to temporarily raise the limit? cc @rust-lang/infra |
@michaelwoerister @alexcrichton The
If we add the actual input/output types, it will significantly inflate symbol name sizes, whereas a hash would be a constant overhead (but @michaelwoerister's RFC tries to avoid hashes for anything other than crate roots). IMO ideally the entire dylib would be versioned in some way, so a new build would be incompatible - IIRC we have something (SVH?) for detecting this when EDIT: one hacky way would be holding pointers to dylib dependency statics (each containing SVH or equivalent in their symbol name) in a static of each crate. |
Do you mean only for this try build or for a while? We'd have to ask Travis Support either way. |
@pietroalbini Only for this build, mostly for running crater. I suppose I can disable some of the work not needed to check symbols, but the roundtrip check is probably the most expensive thing anyway. I guess I'll see how long it takes for the PR build to fail again, with as much as possible disabled. |
The job Click to expand the log.
I'm a bot! I can only do what humans tell me to, so if this was not helpful or you have suggestions for improvements, please ping or otherwise contact |
☔ The latest upstream changes (presumably #57901) made this pull request unmergeable. Please resolve the merge conflicts. |
Time-to-fail is not as useful as I hoped, so I turned off the failing test (#57967 (comment)). |
@bors try |
Introduce Rust symbol mangling scheme. This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 - but with some differences, see rust-lang/rfcs#2603 (comment) for details. The demangling implementation PR is rust-lang/rustc-demangle#23 (this PR already uses it via a git dependency, to allow testing). Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel. <hr/> *Notes for reviewers*: * only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand) * the "TEMPORARY" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater * there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
☀️ Test successful - checks-travis |
@craterbot run start=master#c1c3c4e95b69dfeaca5c5db6c622d7f90ad30a54 end=try#7fea0229842e79db1159ea58ad9a653b288efee9 |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
Thanks, @eddyb! That's an epic amount of refactorings It might make sense to split the |
I don't know yet what to do about the failing test. I believe that the same thing would be caught if things went through cargo, because then the two crates would have a different disambiguator. Or at least they probably should have a different disambiguator. |
The regex should be fixed now - @michaelwoerister found out that on macOS, non- @bors r=michaelwoerister |
This comment has been minimized.
This comment has been minimized.
@bors r=michaelwoerister |
📌 Commit 3652ea4 has been approved by |
Introduce Rust symbol mangling scheme. This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603 ~~- but with some differences, see rust-lang/rfcs#2603 (comment) for details~~ (@michaelwoerister integrated my proposed changes into the RFC itself). On nightly, you can now control the mangling scheme with `-Z symbol-mangling-version`, which can be: * `legacy`: the older mangling version, still the default currently * `v0`: the new RFC mangling version, as implemented by this PR To test the new mangling, set `RUSTFLAGS=-Zsymbol-mangling-version=v0` (or change [`rustflags` in `.cargo/config.toml`](https://doc.rust-lang.org/cargo/reference/config.html#configuration-keys)). 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, and it may take a while for everything to be upstreamed. However, `RUST_BACKTRACE` should work out of the box with either mangling version. <hr/> The demangling implementation PR is rust-lang/rustc-demangle#23 ~~(this PR already uses it via a git dependency, to allow testing)~~. Discussion of the *design* of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel. *Notes for reviewers*: * ~~only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)~~ ~~based on #58140~~ * the "harness" commit is only there because it does some extra validation (comparing the demangling from `rustc-demangle` to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on crater * ~~there is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a `-Z` flag for now~~ (we're gating this on `-Z symbol-mangling-version=v0`, see above) r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler
☀️ Test successful - checks-travis, status-appveyor |
Tested on commit rust-lang/rust@7840a0b. Direct link to PR: <rust-lang/rust#57967> 💔 rls on windows: test-pass → test-fail (cc @Xanewok, @rust-lang/infra).
This is the libiberty (mainly for binutils/gdb) counterpart of rust-lang/rustc-demangle#23. Relevant links for the new Rust mangling scheme (aka "v0"): * Rust RFC: rust-lang/rfcs#2603 * tracking issue: rust-lang/rust#60705 * implementation: rust-lang/rust#57967 This implementation includes full support for UTF-8 identifiers via punycode, so I've included a testcase for that as well. libiberty/ChangeLog: * rust-demangle.c (struct rust_demangler): Add skipping_printing and bound_lifetime_depth fields. (eat): Add (v0-only). (parse_integer_62): Add (v0-only). (parse_opt_integer_62): Add (v0-only). (parse_disambiguator): Add (v0-only). (struct rust_mangled_ident): Add punycode{,_len} fields. (parse_ident): Support v0 identifiers. (print_str): Respect skipping_printing. (print_uint64): Add (v0-only). (print_uint64_hex): Add (v0-only). (print_ident): Respect skipping_printing, Support v0 identifiers. (print_lifetime_from_index): Add (v0-only). (demangle_binder): Add (v0-only). (demangle_path): Add (v0-only). (demangle_generic_arg): Add (v0-only). (demangle_type): Add (v0-only). (demangle_path_maybe_open_generics): Add (v0-only). (demangle_dyn_trait): Add (v0-only). (demangle_const): Add (v0-only). (demangle_const_uint): Add (v0-only). (basic_type): Add (v0-only). (rust_demangle_callback): Support v0 symbols. * testsuite/rust-demangle-expected: Add v0 testcases.
This is the libiberty (mainly for binutils/gdb) counterpart of rust-lang/rustc-demangle#23. Relevant links for the new Rust mangling scheme (aka "v0"): * Rust RFC: rust-lang/rfcs#2603 * tracking issue: rust-lang/rust#60705 * implementation: rust-lang/rust#57967 This implementation includes full support for UTF-8 identifiers via punycode, so I've included a testcase for that as well. libiberty/ChangeLog 2021-01-16 Eduard-Mihai Burtescu <eddyb@lyken.rs> * rust-demangle.c (struct rust_demangler): Add skipping_printing and bound_lifetime_depth fields. (eat): Add (v0-only). (parse_integer_62): Add (v0-only). (parse_opt_integer_62): Add (v0-only). (parse_disambiguator): Add (v0-only). (struct rust_mangled_ident): Add punycode{,_len} fields. (parse_ident): Support v0 identifiers. (print_str): Respect skipping_printing. (print_uint64): Add (v0-only). (print_uint64_hex): Add (v0-only). (print_ident): Respect skipping_printing, Support v0 identifiers. (print_lifetime_from_index): Add (v0-only). (demangle_binder): Add (v0-only). (demangle_path): Add (v0-only). (demangle_generic_arg): Add (v0-only). (demangle_type): Add (v0-only). (demangle_path_maybe_open_generics): Add (v0-only). (demangle_dyn_trait): Add (v0-only). (demangle_const): Add (v0-only). (demangle_const_uint): Add (v0-only). (basic_type): Add (v0-only). (rust_demangle_callback): Support v0 symbols. * testsuite/rust-demangle-expected: Add v0 testcases.
This is an implementation of a "feature-complete" Rust mangling scheme, in the vein of rust-lang/rfcs#2603
- but with some differences, see rust-lang/rfcs#2603 (comment) for details(@michaelwoerister integrated my proposed changes into the RFC itself).On nightly, you can now control the mangling scheme with
-Z symbol-mangling-version
, which can be:legacy
: the older mangling version, still the default currentlyv0
: the new RFC mangling version, as implemented by this PRTo test the new mangling, set
RUSTFLAGS=-Zsymbol-mangling-version=v0
(or changerustflags
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, and it may take a while for everything to be upstreamed. However,RUST_BACKTRACE
should work out of the box with either mangling version.The demangling implementation PR is rust-lang/rustc-demangle#23
(this PR already uses it via a git dependency, to allow testing).Discussion of the design of the mangling scheme should still happen on the RFC, but this PR's specific implementation details can be reviewed in parallel.
Notes for reviewers:
only the last 6 commits are specific to this branch, if necessary I can open a separate PR for everything else (it was meant to be its own small refactoring, but it got a bit out of hand)based on Refactor ppaux out of existence. #58140rustc-demangle
to the compiler's pretty-printing, adjusted slightly to produce the same output), that I would like to try on craterthere is the question of whether we should turn on the new mangling now, wait for tools to support it (I'm working on that), and/or have it under a(we're gating this on-Z
flag for now-Z symbol-mangling-version=v0
, see above)r? @nikomatsakis / @michaelwoerister cc @rust-lang/compiler