Skip to content

Commit 8e42fa5

Browse files
committed
Add test for deduplicate native lib in linking
1 parent 004614c commit 8e42fa5

File tree

5 files changed

+36
-0
lines changed

5 files changed

+36
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ignore-msvc
2+
3+
-include ../tools.mk
4+
5+
all:
6+
$(RUSTC) depa.rs
7+
$(RUSTC) depb.rs
8+
$(RUSTC) depc.rs
9+
$(RUSTC) empty.rs --cfg bar 2>&1 | $(CGREP) '"-ltesta" "-ltestb" "-ltesta"'
10+
$(RUSTC) empty.rs 2>&1 | $(CGREP) '"-ltesta"'
11+
$(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltestb"'
12+
$(RUSTC) empty.rs 2>&1 | $(CGREP) -v '"-ltesta" "-ltesta"'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#![crate_type = "rlib"]
2+
3+
#[link(name = "testa")]
4+
extern "C" {}
5+
6+
#[link(name = "testa")]
7+
extern "C" {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#![feature(link_cfg)]
2+
#![crate_type = "rlib"]
3+
4+
#[link(name = "testb", cfg(foo))]
5+
extern "C" {}
6+
7+
#[link(name = "testb", cfg(bar))]
8+
extern "C" {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#![crate_type = "rlib"]
2+
3+
#[link(name = "testa")]
4+
extern "C" {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extern crate depa;
2+
extern crate depb;
3+
extern crate depc;
4+
5+
fn main() {}

0 commit comments

Comments
 (0)