-
Notifications
You must be signed in to change notification settings - Fork 13.4k
multiple definition link error when using multiple codegen units #32518
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Does it happen without codegen-units option? |
Ha, good question, let me check! It used to work fine even with codegen units maybe a week ago. |
cc @nikomatsakis, perhaps this is a regression from #32469 |
This error also isn't related to ARM, you can reproduce with a bootstrap with some number of codegen units (I used 8 locally) |
Minimized: cgu.rs #![crate_type="lib"]
pub fn id<T>(t: T) {
} a.rs #![crate_type="lib"]
extern crate cgu;
pub mod a {
pub fn a() {
::cgu::id(());
}
}
pub mod b {
pub fn a() {
::cgu::id(());
}
} b.rs #![crate_type="lib"]
extern crate cgu;
pub mod a {
pub fn a() {
::cgu::id(());
}
}
pub mod b {
pub fn a() {
::cgu::id(());
}
} main.rs extern crate a;
extern crate b;
fn main() {
a::a::a();
b::a::a();
} The problem here is that the |
Seems likely to be a regression, yes. @dotdash, I take it from the assignment that you are fixing it? (If so, how do you plan to do so?) |
(I imagine that whatever we do for drop glue ought to work here, since I believe those are also shared across CGU.) |
OK, the assertions build (
Posting here in case it's related to the PR that'd been linked above. |
igd ICE is #32530. |
When reuing a definition across codegen units, we obviously cannot use internal linkage, but using external linkage means that we can end up with multiple conflicting definitions of a single symbol across multiple crates. Since the definitions should all be equal semantically, we can use weak_odr linkage to resolve the situation. Fixes rust-lang#32518
Use weak_odr linkage when reusing definitions across codegen units When reuing a definition across codegen units, we obviously cannot use internal linkage, but using external linkage means that we can end up with multiple conflicting definitions of a single symbol across multiple crates. Since the definitions should all be equal semantically, we can use weak_odr linkage to resolve the situation. Fixes #32518 r? @nikomatsakis
I wanted to use @dotdash's LLVM assertions patch but now my stage1 libstd fails to link. Probably unrelated but here it is:
and so on. Configured with
--enable-optimize --disable-jemalloc --enable-llvm-assertions
andRUSTFLAGS='-C codegen-units=4 -C link-args=-s'
Are all these errors about memory management functions? (
--disable-jemalloc
broken again?)The text was updated successfully, but these errors were encountered: