Skip to content

Tell LLVM to not mangle names if they're already mangled #1063

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

Conversation

liranringel
Copy link
Contributor

LLVM mangles the name by default but functions are already mangled because the link_name attribute's value is mangled.
Prefixing the name with \u{1} should tell LLVM to not mangle it.

I originally thought it's a bug in rustc, but it was clarified here: rust-lang/rust#45073

Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one!

Is there a test-case for this? Also, I think this should allow us to simplify the mangling hack we do to unmangle it.

@liranringel
Copy link
Contributor Author

liranringel commented Oct 7, 2017

Could you explain about the mangling hack?
I think this PR made it redundant. I'll try to delete it.

Edit:
I removed the "mangling hack" and fixed the tests (now we expect the link_name to start with \u{1}, so the PR is tested).

@liranringel liranringel force-pushed the disable-mangling-if-link-name-is-specified branch from 07d59c8 to 1b6345d Compare October 7, 2017 12:57
@liranringel liranringel force-pushed the disable-mangling-if-link-name-is-specified branch from 1b6345d to f2b30c8 Compare October 7, 2017 14:03
Copy link
Contributor

@emilio emilio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely, r=me, thanks a lot!

@emilio
Copy link
Contributor

emilio commented Oct 8, 2017

@bors-servo r+

@bors-servo
Copy link

📌 Commit f2b30c8 has been approved by emilio

@bors-servo
Copy link

⌛ Testing commit f2b30c8 with merge 745d606...

bors-servo pushed a commit that referenced this pull request Oct 8, 2017
…ecified, r=emilio

Tell LLVM to not mangle names if they're already mangled

LLVM mangles the name by default but functions are already mangled because the `link_name` attribute's value is mangled.
Prefixing the name with `\u{1}` should tell LLVM to not mangle it.

I originally thought it's a bug in rustc, but it was clarified here: rust-lang/rust#45073
@bors-servo
Copy link

☀️ Test successful - status-travis
Approved by: emilio
Pushing 745d606 to master...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants