-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
arbitrary link argument like -C link-arg, but respecting relative order to other `-l` options, unstable
- Loading branch information
Showing
22 changed files
with
115 additions
and
20 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
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,10 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
all: | ||
# Build deps | ||
$(RUSTC) native_dep_1.rs --crate-type=staticlib | ||
$(RUSTC) native_dep_2.rs --crate-type=staticlib | ||
$(RUSTC) rust_dep.rs -l static:-bundle=native_dep_1 -l link-arg=some_flag -l static:-bundle=native_dep_2 --crate-type=lib -Z unstable-options | ||
|
||
# Check sequence of linker args | ||
$(RUSTC) main.rs --extern lib=$(TMPDIR)/librust_dep.rlib --crate-type=bin --print link-args | $(CGREP) -e 'native_dep_1.*some_flag.*native_dep_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 @@ | ||
fn main() { | ||
lib::f(); | ||
} |
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 @@ | ||
pub fn f1() {} |
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 @@ | ||
pub fn f2() {} |
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" { | ||
pub fn foo(); | ||
} | ||
|
||
pub fn f() { | ||
unsafe { | ||
foo(); | ||
} | ||
} |
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 @@ | ||
-include ../../run-make-fulldeps/tools.mk | ||
|
||
all: | ||
$(RUSTC) rs.rs -Z unstable-options -l static=l1 -l link-arg=a1 -l static=l2 -l link-arg=a2 -l dylib=d1 -l link-arg=a3 --print link-args | $(CGREP) -e 'l1.*a1.*l2.*a2.*d1.*a3' |
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 @@ | ||
fn main() {} |
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,5 +1,5 @@ | ||
// compile-flags:-l bar=foo | ||
// error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework | ||
// error-pattern: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg | ||
|
||
fn main() { | ||
} |
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,2 +1,2 @@ | ||
error: unknown library kind `bar`, expected one of: static, dylib, framework | ||
error: unknown library kind `bar`, expected one of: static, dylib, framework, link-arg | ||
|
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,5 +1,5 @@ | ||
// compile-flags:-l raw-dylib=foo | ||
// error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework | ||
// error-pattern: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg | ||
|
||
fn main() { | ||
} |
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,2 +1,2 @@ | ||
error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework | ||
error: unknown library kind `raw-dylib`, expected one of: static, dylib, framework, link-arg | ||
|
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,6 @@ | ||
// Unspecified kind should fail with an error | ||
|
||
// compile-flags: -l =mylib | ||
// error-pattern: unknown library kind ``, expected one of: static, dylib, framework | ||
// error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg | ||
|
||
fn main() {} |
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,2 +1,2 @@ | ||
error: unknown library kind ``, expected one of: static, dylib, framework | ||
error: unknown library kind ``, expected one of: static, dylib, framework, link-arg | ||
|
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,6 @@ | ||
// Unspecified kind should fail with an error | ||
|
||
// compile-flags: -l :+bundle=mylib | ||
// error-pattern: unknown library kind ``, expected one of: static, dylib, framework | ||
// error-pattern: unknown library kind ``, expected one of: static, dylib, framework, link-arg | ||
|
||
fn main() {} |
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,2 +1,2 @@ | ||
error: unknown library kind ``, expected one of: static, dylib, framework | ||
error: unknown library kind ``, expected one of: static, dylib, framework, link-arg | ||
|
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 @@ | ||
// compile-flags: -l link-arg:+bundle=arg -Z unstable-options | ||
// error-pattern: linking modifier `bundle` is only compatible with `static` linking kind | ||
|
||
fn main() {} |
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,2 @@ | ||
error: linking modifier `bundle` is only compatible with `static` linking kind | ||
|
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,8 @@ | ||
// link-arg is not supposed to be usable in #[link] attributes | ||
|
||
// compile-flags: | ||
// error-pattern: error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib | ||
|
||
#[link(kind = "link-arg")] | ||
extern "C" {} | ||
pub fn main() {} |
16 changes: 16 additions & 0 deletions
16
src/test/ui/native-library-link-flags/link-arg-from-rs.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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error[E0458]: unknown link kind `link-arg`, expected one of: static, dylib, framework, raw-dylib | ||
--> $DIR/link-arg-from-rs.rs:6:15 | ||
| | ||
LL | #[link(kind = "link-arg")] | ||
| ^^^^^^^^^^ unknown link kind | ||
|
||
error[E0459]: `#[link]` attribute requires a `name = "string"` argument | ||
--> $DIR/link-arg-from-rs.rs:6:1 | ||
| | ||
LL | #[link(kind = "link-arg")] | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ missing `name` argument | ||
|
||
error: aborting due to 2 previous errors | ||
|
||
Some errors have detailed explanations: E0458, E0459. | ||
For more information about an error, try `rustc --explain E0458`. |