Uh oh!
There was an error while loading. Please reload this page.
rustc: Handle some libstd symbole exports better - #45710
Merged
Merged
Conversation
rust-highfive
commented
Nov 2, 2017
Contributor
r? @arielb1 (rust_highfive has picked a reviewer for you, use r? to override) |
alexcrichton
commented
Nov 2, 2017
MemberAuthor
michaelwoerister
commented
Nov 3, 2017
Member
Nice! Thanks @alexcrichton. @bors r+ |
bors
commented
Nov 3, 2017
Collaborator
📌 Commit e913be0 has been approved by |
shepmaster
commented
Nov 3, 2017
Member
bors
commented
Nov 4, 2017
Collaborator
⌛ Testing commit e913be083f4f322d2874ffdabcff8a1aef9255f8 with merge e53898d66af9ab77071cf832170fc2972d1af3e8... |
bors
commented
Nov 4, 2017
Collaborator
💔 Test failed - status-appveyor |
Right now symbol exports, particularly in a cdylib, are handled by assuming that `pub extern` combined with `#[no_mangle]` means "export this". This isn't actually what we want for some symbols that the standard library uses to implement itself, for example symbols related to allocation. Additionally other special symbols like `rust_eh_personallity` have no need to be exported from cdylib crate types (only needed in dylib crate types). This commit updates how rustc handles these special symbols by adding to the hardcoded logic of symbols like `rust_eh_personallity` but also adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the export level to be considered the same as all other Rust functions instead of looking like a C function. The eventual goal here is to prevent functions like `__rdl_alloc` from showing up as part of a Rust cdylib as it's just an internal implementation detail. This then further allows such symbols to get gc'd by the linker when creating a cdylib.
alexcrichtonforce-pushed
the
std-symbols
branch
from
November 5, 2017 03:01
e913be0 to
fbf9869Comparealexcrichton
commented
Nov 5, 2017
MemberAuthor
@bors: r=michaelwoerister |
bors
commented
Nov 5, 2017
Collaborator
📌 Commit fbf9869 has been approved by |
bors
commented
Nov 5, 2017
Collaborator
bors added a commit
that referenced
this pull request
Nov 5, 2017
rustc: Handle some libstd symbole exports better Right now symbol exports, particularly in a cdylib, are handled by assuming that `pub extern` combined with `#[no_mangle]` means "export this". This isn't actually what we want for some symbols that the standard library uses to implement itself, for example symbols related to allocation. Additionally other special symbols like `rust_eh_personallity` have no need to be exported from cdylib crate types (only needed in dylib crate types). This commit updates how rustc handles these special symbols by adding to the hardcoded logic of symbols like `rust_eh_personallity` but also adding a new attribute, `#[rustc_std_internal_symbol]`, which forces the export level to be considered the same as all other Rust functions instead of looking like a C function. The eventual goal here is to prevent functions like `__rdl_alloc` from showing up as part of a Rust cdylib as it's just an internal implementation detail. This then further allows such symbols to get gc'd by the linker when creating a cdylib.
bors
commented
Nov 5, 2017
Collaborator
☀️ Test successful - status-appveyor, status-travis |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Right now symbol exports, particularly in a cdylib, are handled by
assuming that
pub externcombined with#[no_mangle]means "exportthis". This isn't actually what we want for some symbols that the
standard library uses to implement itself, for example symbols related
to allocation. Additionally other special symbols like
rust_eh_personallityhave no need to be exported from cdylib cratetypes (only needed in dylib crate types).
This commit updates how rustc handles these special symbols by adding to
the hardcoded logic of symbols like
rust_eh_personallitybut alsoadding a new attribute,
#[rustc_std_internal_symbol], which forces theexport level to be considered the same as all other Rust functions
instead of looking like a C function.
The eventual goal here is to prevent functions like
__rdl_allocfromshowing up as part of a Rust cdylib as it's just an internal
implementation detail. This then further allows such symbols to get gc'd
by the linker when creating a cdylib.