Implement -Zlink-native-libraries
This implements a flag `-Zlink-native-libraries=yes/no`. If set to true/yes, or unspecified, then native libraries referenced via `#[link]` attributes will be put on the linker line (ie, unchanged behaviour). If `-Zlink-native-libraries=no` is specified then rustc will not add the native libraries to the link line. The assumption is that the outer build system driving the build already knows about the native libraries and will specify them to the linker directly (for example via `-Clink-arg=`). Addresses issue #70093
This commit is contained in:
parent
0a2df62073
commit
53c4e0c19a
3 changed files with 20 additions and 3 deletions
8
src/test/ui/issues/issue-70093.rs
Normal file
8
src/test/ui/issues/issue-70093.rs
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
// run-pass
|
||||
// compile-flags: -Zlink-native-libraries=no -Cdefault-linker-libraries=yes
|
||||
// ignore-windows - this will probably only work on unixish systems
|
||||
|
||||
#[link(name = "some-random-non-existent-library", kind = "static")]
|
||||
extern "C" {}
|
||||
|
||||
fn main() {}
|
||||
Loading…
Add table
Add a link
Reference in a new issue