Skip to content
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

Merged
merged 1 commit into from May 29, 2019

Conversation

Projects
None yet
5 participants
@davidtwco
Copy link
Member

commented May 25, 2019

Fixes #60925 and fixes #53912.

r? @michaelwoerister
cc @eddyb

@davidtwco

This comment has been minimized.

Copy link
Member Author

commented May 25, 2019

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.

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

commented May 27, 2019

Thanks for looking into it, @davidtwco! That should fix the issue.

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented May 27, 2019

📋 Looks like this PR is still in progress, ignoring approval.

Hint: Remove WIP from this PR's title when it is ready for review.

@michaelwoerister

This comment has been minimized.

Copy link
Contributor

commented May 27, 2019

Good call, bors... Regarding a test: You need to write some code with a module or function named llvm, I'd say, and then test that the symbol name does not contain the string .llvm. [ui/symbol-names](https://github.com/rust-lang/rust/tree/master/src/test/ui/symbol-names] show one way of checking symbol names. A codegen would be another option.

@eddyb

This comment has been minimized.

Copy link
Member

commented May 28, 2019

#53912 has a reduction (I guess it's tricky to cause it because the segfault is in LTO).

@davidtwco davidtwco force-pushed the davidtwco:seg-fault-mangler branch from 1803781 to 1c42a76 May 28, 2019

Special-case `.llvm` in mangler to fix segfaults
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`.

@davidtwco davidtwco force-pushed the davidtwco:seg-fault-mangler branch from 1c42a76 to 9c34473 May 28, 2019

@davidtwco davidtwco changed the title WIP: Special-case `.llvm` in mangler Special-case `.llvm` in mangler May 28, 2019

@davidtwco

This comment has been minimized.

Copy link
Member Author

commented May 28, 2019

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).

@eddyb

eddyb approved these changes May 28, 2019

@eddyb

This comment has been minimized.

Copy link
Member

commented May 28, 2019

@bors r+

@bors

This comment has been minimized.

Copy link
Contributor

commented May 28, 2019

📌 Commit 9c34473 has been approved by eddyb

Centril added a commit to Centril/rust that referenced this pull request May 28, 2019

bors added a commit that referenced this pull request May 28, 2019

Auto merge of #61296 - Centril:rollup-5ad68b0, r=Centril
Rollup of 9 pull requests

Successful merges:

 - #60742 (Allow const parameters in array sizes to be unified)
 - #60756 (Add better tests for hidden lifetimes in impl trait)
 - #60928 (Changes the type `mir::Mir` into `mir::Body`)
 - #61024 (tests: Centralize proc macros commonly used for testing)
 - #61157 (BufReader: In Seek impl, remove extra discard_buffer call)
 - #61195 (Special-case `.llvm` in mangler)
 - #61202 (Print PermissionExt::mode() in octal in Documentation Examples)
 - #61259 (Mailmap fixes)
 - #61273 (mention that MaybeUninit is a bit like Option)

Failed merges:

r? @ghost

@bors bors merged commit 9c34473 into rust-lang:master May 29, 2019

1 check passed

Travis CI - Pull Request Build Passed
Details

@davidtwco davidtwco deleted the davidtwco:seg-fault-mangler branch May 29, 2019

@@ -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$"),

This comment has been minimized.

Copy link
@eddyb

eddyb Jun 1, 2019

Member

Ooops, turns out this should be $u6d$ (i.e. note the u).

This comment has been minimized.

Copy link
@davidtwco

davidtwco Jun 1, 2019

Author Member

I've submitted #61423 that changes this.

davidtwco added a commit to davidtwco/rust that referenced this pull request Jun 1, 2019

codegen: change `$6d$` to `$u6d$`
This changes a mistake introduced in rust-lang#61195 where the mangling
workaround used was incorrect.

Centril added a commit to Centril/rust that referenced this pull request Jun 2, 2019

Rollup merge of rust-lang#61423 - davidtwco:correct-symbol-mangling, …
…r=eddyb

codegen: change `$6d$` to `$u6d$`

This changes a mistake introduced in rust-lang#61195 where the mangling
workaround used was incorrect, resolving [this comment](rust-lang#61195 (comment)) from @eddyb.

r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.