-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Conversation
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 |
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.
Should say get_declared_value
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. |
@bors r+ |
📌 Commit e17c48b has been approved by |
@bors p=1 Probably unblocks servo/servo#10173 |
I confirm that I don't get the compilation error anymore, with this patch. Thanks @eddyb 😃 |
@bors-servo p=20 rollum shmollup this is more important |
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.
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.
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.