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

trans: Make names of internal symbols independent of CGU translation order #37328

Merged
merged 3 commits into from
Oct 25, 2016

Conversation

michaelwoerister
Copy link
Member

Every codegen unit gets its own local counter for generating new symbol names. This makes bitcode and object files reproducible at the binary level even when incremental compilation is used.

The PR also solves a rare ICE resulting from a naming conflict between a user defined name and a generated one. E.g. try compiling the following program with 1.12.1 stable:

#![crate_type="lib"]

#[no_mangle]
pub fn str7233() -> &'static str { "foo" }

This results in:

error: internal compiler error: ../src/librustc_trans/common.rs:979: symbol str7233 is already defined

Running into this is not very likely but it's also easily avoidable.

…order.

Every codegen unit gets its own local counter for generating new symbol
names. This makes bitcode and object files reproducible at the binary
level even when incremental compilation is used.
@michaelwoerister
Copy link
Member Author

r? @nagisa (This should take care of a FIXME you added a while ago)

@nagisa
Copy link
Member

nagisa commented Oct 24, 2016

r=me (you’ll have to instruct bors yourself). I was kind of surprised about there only being 2 uses of gensym left.

@michaelwoerister
Copy link
Member Author

@bors r=nagisa

Thanks for the review!

@bors
Copy link
Contributor

bors commented Oct 24, 2016

📌 Commit 992203b has been approved by nagisa

sophiajt pushed a commit to sophiajt/rust that referenced this pull request Oct 24, 2016
…l-names, r=nagisa

trans: Make names of internal symbols independent of CGU translation order

Every codegen unit gets its own local counter for generating new symbol names. This makes bitcode and object files reproducible at the binary level even when incremental compilation is used.

The PR also solves a rare ICE resulting from a naming conflict between a user defined name and a generated one. E.g. try compiling the following program with 1.12.1 stable:
```rust

pub fn str7233() -> &'static str { "foo" }
```
This results in:
> error: internal compiler error: ../src/librustc_trans/common.rs:979: symbol `str7233` is already defined

Running into this is not very likely but it's also easily avoidable.
bors added a commit that referenced this pull request Oct 24, 2016
Rollup of 7 pull requests

- Successful merges: #37228, #37304, #37324, #37328, #37336, #37349, #37372
- Failed merges:
@bors bors merged commit 992203b into rust-lang:master Oct 25, 2016
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.

3 participants