-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Enable new rlib in non stable cases #105601
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
# ignore-cross-compile | ||
# only-linux | ||
|
||
# Make sure -Zpacked_bundled_libs-like behavior activates with whole-archive. | ||
|
||
# We're using the llvm-nm instead of the system nm to ensure it is compatible | ||
# with the LLVM bitcode generated by rustc. | ||
NM = "$(LLVM_BIN_DIR)"/llvm-nm | ||
|
||
all: $(call NATIVE_STATICLIB,native_dep_1) $(call NATIVE_STATICLIB,native_dep_2) $(call NATIVE_STATICLIB,native_dep_3) $(call NATIVE_STATICLIB,native_dep_4) | ||
# test cfg with packed bundle | ||
$(RUSTC) rust_dep_cfg.rs --crate-type=rlib -Zpacked_bundled_libs | ||
$(RUSTC) main.rs --extern rust_dep=$(TMPDIR)/librust_dep_cfg.rlib --crate-type=staticlib --cfg should_add | ||
$(AR) t $(TMPDIR)/librust_dep_cfg.rlib | $(CGREP) -e "libnative_dep_1.a" | ||
$(AR) t $(TMPDIR)/librust_dep_cfg.rlib | $(CGREP) -e "libnative_dep_2.a" | ||
$(AR) t $(TMPDIR)/libmain.a | $(CGREP) -e "libnative_dep_1.o" | ||
$(AR) t $(TMPDIR)/libmain.a | $(CGREP) -ev "libnative_dep_2.o" | ||
|
||
|
||
# test bundle with whole_archive | ||
$(RUSTC) rust_dep.rs --crate-type=rlib | ||
$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -e "native_dep_1" | ||
$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -e "native_dep_3" | ||
$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -ev "native_dep_2" | ||
$(AR) t $(TMPDIR)/librust_dep.rlib | $(CGREP) -ev "native_dep_4" | ||
|
||
# Make sure compiler doesn't use files, that it shouldn't know about. | ||
rm $(TMPDIR)/libnative_dep_1.a | ||
rm $(TMPDIR)/libnative_dep_3.a | ||
|
||
$(RUSTC) main.rs --extern rust_dep=$(TMPDIR)/librust_dep.rlib --print link-args > $(TMPDIR)/link_args | ||
cat $(TMPDIR)/link_args | $(CGREP) -ev "native_dep_3" | ||
cat $(TMPDIR)/link_args | $(CGREP) -e "--whole-archive.*native_dep_1.*--whole-archive.*lnative_dep_2.*no-whole-archive.*lnative_dep_4" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
extern crate rust_dep; | ||
|
||
pub fn main() { | ||
rust_dep::rust_dep(); | ||
} |
1 change: 1 addition & 0 deletions
1
tests/run-make/rlib-format-packed-bundled-libs-3/native_dep_1.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int native_f1() { return 1; } |
1 change: 1 addition & 0 deletions
1
tests/run-make/rlib-format-packed-bundled-libs-3/native_dep_2.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int native_f2() { return 2; } |
1 change: 1 addition & 0 deletions
1
tests/run-make/rlib-format-packed-bundled-libs-3/native_dep_3.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int native_f3() { return 3; } |
1 change: 1 addition & 0 deletions
1
tests/run-make/rlib-format-packed-bundled-libs-3/native_dep_4.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
int native_f4() { return 4; } |
16 changes: 16 additions & 0 deletions
16
tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#![feature(packed_bundled_libs)] | ||
|
||
#[link(name = "native_dep_1", kind = "static", modifiers = "+whole-archive,+bundle")] | ||
extern "C" {} | ||
|
||
#[link(name = "native_dep_2", kind = "static", modifiers = "+whole-archive,-bundle")] | ||
extern "C" {} | ||
|
||
#[link(name = "native_dep_3", kind = "static", modifiers = "+bundle")] | ||
extern "C" {} | ||
|
||
#[link(name = "native_dep_4", kind = "static", modifiers = "-bundle")] | ||
extern "C" {} | ||
|
||
#[no_mangle] | ||
pub fn rust_dep() {} |
10 changes: 10 additions & 0 deletions
10
tests/run-make/rlib-format-packed-bundled-libs-3/rust_dep_cfg.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#![feature(link_cfg)] | ||
|
||
#[link(name = "native_dep_1", kind = "static", cfg(should_add))] | ||
extern "C" {} | ||
|
||
#[link(name = "native_dep_2", kind = "static", cfg(should_not_add))] | ||
extern "C" {} | ||
|
||
#[no_mangle] | ||
pub fn rust_dep() {} |
13 changes: 8 additions & 5 deletions
13
tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
// compile-flags: -Zunstable-options --crate-type rlib | ||
// gate-test-packed_bundled_libs | ||
|
||
// ignore-wasm32-bare | ||
// compile-flags: --crate-type rlib | ||
// error-pattern: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs | ||
// build-fail | ||
// error-pattern: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs | ||
|
||
#[link(name = "mylib", kind = "static", modifiers = "+bundle,+whole-archive")] | ||
extern "C" { } | ||
#[link(name = "rust_test_helpers", kind = "static", modifiers = "+bundle,+whole-archive")] | ||
extern "C" {} | ||
|
||
fn main() { } | ||
fn main() {} |
6 changes: 2 additions & 4 deletions
6
tests/ui/native-library-link-flags/mix-bundle-and-whole-archive-link-attr.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
error: the linking modifiers `+bundle` and `+whole-archive` are not compatible with each other when generating rlibs | ||
error: link modifiers combination `+bundle,+whole-archive` is unstable when generating rlibs | ||
|
||
error: could not find native static library `mylib`, perhaps an -L flag is missing? | ||
|
||
error: aborting due to 2 previous errors | ||
error: aborting due to previous error | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 comment was lost along with the code, and though the code was readded in #110917, the comment was not readded