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: don't declare symbols that were already imported. #32742

Merged
merged 1 commit into from
Apr 5, 2016

Conversation

eddyb
Copy link
Member

@eddyb eddyb commented Apr 5, 2016

Fixes #32740 by checking for a declaration before attempting a new one.
Before, LLVMGetOrInsertFunction was called for a existing import, but with a different type.
The returned value was a cast function pointer instead of a declaration, and we gave this
value to llvm::SetFunctionCallConv & friends , which triggered an LLVM assertion.

@rust-highfive
Copy link
Collaborator

r? @pnkfelix

(rust_highfive has picked a reviewer for you, use r? to override)

@@ -158,15 +158,22 @@ pub fn get_defined_value(ccx: &CrateContext, name: &str) -> Option<ValueRef> {
debug!("get_defined_value: {:?} value is null", name);
None
Copy link
Contributor

Choose a reason for hiding this comment

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

Should say get_declared_value

@eddyb
Copy link
Member Author

eddyb commented Apr 5, 2016

Added the testcase to an existing duplicated FFI import test and confirmed that the snapshot compiler segfaults (because it has LLVM assertions turned off) and an older stage2 build I had laying around triggers the LLVM assertion, while stage1 passes the test.

@dotdash
Copy link
Contributor

dotdash commented Apr 5, 2016

@bors r+

@bors
Copy link
Contributor

bors commented Apr 5, 2016

📌 Commit e17c48b has been approved by dotdash

@dotdash
Copy link
Contributor

dotdash commented Apr 5, 2016

@bors p=1

Probably unblocks servo/servo#10173

@JohanLorenzo
Copy link
Contributor

I confirm that I don't get the compilation error anymore, with this patch. Thanks @eddyb 😃

@Manishearth
Copy link
Member

@bors-servo p=20

rollum shmollup this is more important

@bors
Copy link
Contributor

bors commented Apr 5, 2016

⌛ Testing commit e17c48b with merge 953c3b5...

bors added a commit that referenced this pull request Apr 5, 2016
trans: don't declare symbols that were already imported.

Fixes #32740 by checking for a declaration before attempting a new one.
Before, `LLVMGetOrInsertFunction` was called for a existing import, but with a different type.
The returned value was a cast function pointer instead of a declaration, and we gave this
value to `llvm::SetFunctionCallConv` & friends , which triggered an LLVM assertion.
@bors bors merged commit e17c48b into rust-lang:master Apr 5, 2016
@eddyb eddyb deleted the cast-fns branch April 6, 2016 01:51
Manishearth added a commit to Manishearth/rust that referenced this pull request Apr 15, 2016
trans: always register an item's symbol, even if duplicated.

Fixes rust-lang#32783 which was introduced by not always registering item symbols in rust-lang#32742.
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.

7 participants