-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Deduplicate libraries on hash instead of filename. #32317
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright 2016 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
#![crate_name = "e"] | ||
#![crate_type = "rlib"] | ||
|
||
pub fn f() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,14 +3,15 @@ | |
all: | ||
$(RUSTC) bar.rs --crate-type=rlib | ||
$(RUSTC) bar.rs --crate-type=rlib -C extra-filename=-a | ||
$(RUSTC) bar-alt.rs --crate-type=rlib | ||
$(RUSTC) foo.rs --extern hello && exit 1 || exit 0 | ||
$(RUSTC) foo.rs --extern bar=no-exist && exit 1 || exit 0 | ||
$(RUSTC) foo.rs --extern bar=foo.rs && exit 1 || exit 0 | ||
$(RUSTC) foo.rs \ | ||
--extern bar=$(TMPDIR)/libbar.rlib \ | ||
--extern bar=$(TMPDIR)/libbar-a.rlib \ | ||
--extern bar=$(TMPDIR)/libbar-alt.rlib \ | ||
&& exit 1 || exit 0 | ||
$(RUSTC) foo.rs \ | ||
--extern bar=$(TMPDIR)/libbar.rlib \ | ||
--extern bar=$(TMPDIR)/libbar.rlib | ||
--extern bar=$(TMPDIR)/libbar-a.rlib | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Enhanced to test that deduplication is based on hash and not only name. |
||
$(RUSTC) foo.rs --extern bar=$(TMPDIR)/libbar.rlib |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT | ||
// file at the top-level directory of this distribution and at | ||
// http://rust-lang.org/COPYRIGHT. | ||
// | ||
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
// option. This file may not be copied, modified, or distributed | ||
// except according to those terms. | ||
|
||
pub fn f() {} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,15 +9,13 @@ | |
|
||
all: | ||
mkdir $(TMPDIR)/other | ||
$(RUSTC) foo.rs --crate-type=dylib | ||
$(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic | ||
mv $(call DYLIB,foo) $(TMPDIR)/other | ||
$(RUSTC) foo.rs --crate-type=dylib | ||
$(RUSTC) bar.rs -L $(TMPDIR)/other 2>&1 | \ | ||
grep "multiple dylib candidates" | ||
$(RUSTC) foo.rs --crate-type=dylib -C prefer-dynamic | ||
$(RUSTC) bar.rs -L $(TMPDIR)/other | ||
rm -rf $(TMPDIR) | ||
mkdir -p $(TMPDIR)/other | ||
$(RUSTC) foo.rs --crate-type=rlib | ||
mv $(TMPDIR)/libfoo.rlib $(TMPDIR)/other | ||
$(RUSTC) foo.rs --crate-type=rlib | ||
$(RUSTC) bar.rs -L $(TMPDIR)/other 2>&1 | \ | ||
grep "multiple rlib candidates" | ||
$(RUSTC) bar.rs -L $(TMPDIR)/other | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the primary purpose of this change -- this should not fail as the two crates are basically the same. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you change this test so it still exhibits the same error message? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think that's a good idea. Issue 11908 is about getting assertion failures, not a missing check for "multiple rlib candidates". I will change it to explicitly test for not "assertion failed", which is what the issue was about. |
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.
Changed because two externs with the same hash don't conflict anymore.
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.
This seems like it should still be an error? Passing
--extern bar=...
to two distinct locations seems like it's surely an error?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.
Externs are processed as a single group, so we deduplicate on hash irrespective of the filename.