forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Show diff #5
Closed
Closed
Show diff #5
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
# 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) | ||
# Build native libs | ||
# $(RUSTC) native_dep_1.rs --crate-type=staticlib | ||
# $(RUSTC) native_dep_2.rs --crate-type=staticlib | ||
# $(RUSTC) native_dep_3.rs --crate-type=staticlib | ||
$(NM) $(TMPDIR)/libnative_dep_1.a | $(CGREP) "T native_f1" | ||
$(NM) $(TMPDIR)/libnative_dep_2.a | $(CGREP) "T native_f2" | ||
$(NM) $(TMPDIR)/libnative_dep_3.a | $(CGREP) "T native_f3" | ||
|
||
# Build new rlibs | ||
$(RUSTC) rust_dep_up.rs --crate-type=rlib -Zseparate_native_rlib_dependencies | ||
$(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "U native_f2" | ||
$(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "U native_f3" | ||
$(NM) $(TMPDIR)/librust_dep_up.rlib | $(CGREP) -e "T.*rust_dep_up" | ||
ar t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "libnative_dep_2.a" # FIXME: crossplatform | ||
ar t $(TMPDIR)/librust_dep_up.rlib | $(CGREP) "libnative_dep_3.a" # FIXME: crossplatform | ||
$(RUSTC) rust_dep_local.rs --extern rlib=$(TMPDIR)/librust_dep_up.rlib -Zseparate_native_rlib_dependencies --crate-type=rlib -Z unstable-options | ||
$(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) "U native_f1" | ||
$(NM) $(TMPDIR)/librust_dep_local.rlib | $(CGREP) -e "T.*rust_dep_local" | ||
ar t $(TMPDIR)/librust_dep_local.rlib | $(CGREP) "libnative_dep_1.a" # FIXME: crossplatform | ||
|
||
# Build bin | ||
$(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep_local.rlib --crate-type=bin -Zseparate_native_rlib_dependencies --print link-args | $(CGREP) -e 'native_dep_1.*native_dep_2.*native_dep_3' | ||
$(NM) $(TMPDIR)/main | $(CGREP) "T native_f1" | ||
$(NM) $(TMPDIR)/main | $(CGREP) "T native_f2" | ||
$(NM) $(TMPDIR)/main | $(CGREP) "T native_f3" | ||
$(NM) $(TMPDIR)/main | $(CGREP) -e "T.*rust_dep_local" | ||
$(NM) $(TMPDIR)/main | $(CGREP) -e "T.*rust_dep_up" | ||
|
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_local; | ||
|
||
pub fn main() { | ||
rust_dep_local::rust_dep_local(); | ||
} |
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,3 @@ | ||
int native_f1() { | ||
return 1; | ||
} |
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,3 @@ | ||
int native_f2() { | ||
return 2; | ||
} |
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,3 @@ | ||
int native_f3() { | ||
return 3; | ||
} |
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,13 @@ | ||
#[link(name = "native_dep_1", kind = "static")] | ||
extern "C" { | ||
fn native_f1() -> i32; | ||
} | ||
|
||
extern crate rust_dep_up; | ||
|
||
pub fn rust_dep_local() { | ||
unsafe { | ||
assert!(native_f1() == 1); | ||
} | ||
rust_dep_up::rust_dep_up(); | ||
} |
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,13 @@ | ||
#[link(name = "native_dep_2", kind = "static")] | ||
#[link(name = "native_dep_3", kind = "static")] | ||
extern "C" { | ||
fn native_f2() -> i32; | ||
fn native_f3() -> i32; | ||
} | ||
|
||
pub fn rust_dep_up() { | ||
unsafe { | ||
assert!(native_f2() == 2); | ||
assert!(native_f3() == 3); | ||
} | ||
} |
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
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.
Тут библиотека должна упоминаться по полному пути а не по имени, для этого надо использовать
link(_whole)_rlib
, хотя и имя неподходящее, см rust-lang#99773.