-
Notifications
You must be signed in to change notification settings - Fork 13.3k
rustc: Remove __rust_crate_map_toplevel alias #12588
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
Relevant llvm patch: https://github.com/klutzy/llvm/tree/rust-fix-lto |
It was a hack to workaround llvm bug: when `_rust_crate_map_toplevel` is dll-exported, llvm generated `-export:__rust_crate_map_toplevel,data` where extra underscore is due to unnecessary mangling. Then linker tries to find `__rust_crate_map_toplevel` symbol, but it doesn't exist. Therefore alias was added to prevent the link failure. (See http://llvm.org/bugs/show_bug.cgi?id=10174 for details.) It also caused LTO issue: llvm's LTO pass removes `__rust_crate_map_toplevel` alias for some reason I don't know, so build failed at link time.
Does this require an patch to LLVM itself? If so, have you tried to upstream it first? |
Yes, llvm patch is needed. I haven't tried to upstream yet but I'll try it soon. |
I'm in the process of upstreaming the bulk of the rest of our patches, so I'd prefer to not merge this before seeing what upstream thinks about the LLVM patch. That being said, thank you so much for finding this! I think LLVM will be quite receptive to your patch. |
@@ -1 +1 @@ | |||
Subproject commit b015ecddd3129490fa26e5278a1acee79f2ee5ef | |||
Subproject commit 5fe5e1c63994a2510dc264a37dfb3071f9e3cea0 |
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.
This submodule points towards rust-lang/llvm (it would not work with a commit hash from one of your repos).
@klutzy yay! thanks for getting rid of that annoying wart |
Would it be possible to land the removal of the aliasing before the upgrade to LLVM? |
@alexcrichton Yep, it seems easier to use Anyway I found my llvm patch is wrong (e.g. it breaks msvc-compatibility behavior) so I'm closing this until new fix is done. |
internal: More completion reorganizing
It was a hack to workaround llvm bug: when
_rust_crate_map_toplevel
is dll-exported, llvm generated-export:__rust_crate_map_toplevel,data
where extra underscoreis due to unnecessary mangling. Then linker tries to find
__rust_crate_map_toplevel
symbol, but it doesn't exist.Therefore alias was added to prevent the link failure.
(See http://llvm.org/bugs/show_bug.cgi?id=10174 for details.)
It also caused LTO issue: llvm's LTO pass removes
__rust_crate_map_toplevel
alias for some reason I don't know,so build failed at link time.
Fixes #12471