forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#101806 - BelovDV:issue-fix-fn-find_library, r…
…=petrochenkov fix verbatim with upstream dependencies rust-lang#99425 (comment) r? `@petrochenkov`
- Loading branch information
Showing
8 changed files
with
75 additions
and
19 deletions.
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
15 changes: 15 additions & 0 deletions
15
src/test/run-make/native-link-modifier-verbatim-linker/Makefile
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,15 @@ | ||
# ignore-cross-compile | ||
# ignore-macos | ||
|
||
include ../../run-make-fulldeps/tools.mk | ||
|
||
all: | ||
# Verbatim allows specify precise name. | ||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_some_strange_name.ext | ||
$(RUSTC) main.rs -Zunstable-options -l static:+verbatim=local_some_strange_name.ext | ||
|
||
# With verbatim any other name cannot be used (local). | ||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/liblocal_native_dep.a | ||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.a | ||
$(RUSTC) local_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/local_native_dep.lib | ||
$(RUSTC) main.rs -Zunstable-options -l static:+verbatim=local_native_dep 2>&1 | $(CGREP) "local_native_dep" |
4 changes: 4 additions & 0 deletions
4
src/test/run-make/native-link-modifier-verbatim-linker/local_native_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,4 @@ | ||
#[no_mangle] | ||
pub fn local_native_f() -> i32 { | ||
return 0; | ||
} |
9 changes: 9 additions & 0 deletions
9
src/test/run-make/native-link-modifier-verbatim-linker/main.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,9 @@ | ||
extern "C" { | ||
fn local_native_f() -> i32; | ||
} | ||
|
||
pub fn main() { | ||
unsafe { | ||
assert!(local_native_f() == 0); | ||
}; | ||
} |
12 changes: 12 additions & 0 deletions
12
src/test/run-make/native-link-modifier-verbatim-rustc/Makefile
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,12 @@ | ||
include ../../run-make-fulldeps/tools.mk | ||
|
||
all: | ||
# Verbatim allows specify precise name. | ||
$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_some_strange_name.ext | ||
$(RUSTC) rust_dep.rs -Zunstable-options -l static:+verbatim=upstream_some_strange_name.ext --crate-type rlib | ||
|
||
# With verbatim any other name cannot be used (upstream). | ||
$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/libupstream_native_dep.a | ||
$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.a | ||
$(RUSTC) upstream_native_dep.rs --crate-type=staticlib -o $(TMPDIR)/upstream_native_dep.lib | ||
$(RUSTC) rust_dep.rs -Zunstable-options -l static:+verbatim=upstream_native_dep --crate-type rlib 2>&1 | $(CGREP) "upstream_native_dep" |
9 changes: 9 additions & 0 deletions
9
src/test/run-make/native-link-modifier-verbatim-rustc/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,9 @@ | ||
extern "C" { | ||
fn upstream_native_f() -> i32; | ||
} | ||
|
||
pub fn rust_dep() { | ||
unsafe { | ||
assert!(upstream_native_f() == 0); | ||
} | ||
} |
4 changes: 4 additions & 0 deletions
4
src/test/run-make/native-link-modifier-verbatim-rustc/upstream_native_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,4 @@ | ||
#[no_mangle] | ||
pub fn upstream_native_f() -> i32 { | ||
return 0; | ||
} |