-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Special-case .llvm
in mangler
#61195
Conversation
I believe this is what @eddyb suggested. I wasn't able to work out how to write a test for this, so any thoughts appreciated. |
Thanks for looking into it, @davidtwco! That should fix the issue. @bors r+ |
📋 Looks like this PR is still in progress, ignoring approval. Hint: Remove WIP from this PR's title when it is ready for review. |
Good call, bors... Regarding a test: You need to write some code with a module or function named |
#53912 has a reduction (I guess it's tricky to cause it because the segfault is in LTO). |
1803781
to
1c42a76
Compare
This commit special cases `.llvm` in the mangler to print `.llvm$6d$` instead. This will avoid segfaults when names in a user's Rust code are `llvm`.
1c42a76
to
9c34473
Compare
.llvm
in mangler.llvm
in mangler
Thanks @eddyb and @michaelwoerister. I've added two tests, one that checks the symbol name with the reproduction from #53912 and another that checks that the code compiles successfully (since I wasn't sure that the symbol check attribute didn't exit early). |
@bors r+ |
📌 Commit 9c34473 has been approved by |
@@ -613,6 +613,9 @@ impl fmt::Write for SymbolPrinter<'_, '_> { | |||
// for ':' and '-' | |||
'-' | ':' => self.path.temp_buf.push('.'), | |||
|
|||
// Avoid segmentation fault on some platforms, see #60925. | |||
'm' if self.path.temp_buf.ends_with(".llv") => self.path.temp_buf.push_str("$6d$"), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ooops, turns out this should be $u6d$
(i.e. note the u
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've submitted #61423 that changes this.
Fixes #60925 and fixes #53912.
r? @michaelwoerister
cc @eddyb