Skip to content

Commit e508923

Browse files
authored
Merge pull request #246 from rust-secure-code/windows-bare-linker-tests
Add bare linker tests for Windows
2 parents 66bb33f + 5747f34 commit e508923

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

cargo-auditable/tests/fixtures/bare_linker/.cargo/config.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,15 @@ rustflags = ["-C", "target-feature=+crt-static"]
3232
linker = "rust-lld"
3333
rustflags = ["-C", "target-feature=+crt-static"]
3434

35+
# === Not included in the original Rayhunter example ===
36+
37+
# this tests for https://github.com/rust-lang/rust/issues/96498
38+
[target.i686-pc-windows-msvc]
39+
linker = "rust-lld"
40+
41+
# this Just Works so we might as well see if it keeps working
42+
[target.x86_64-pc-windows-msvc]
43+
linker = "rust-lld"
44+
45+
# GNU targets generally don't work with bare linkers; not even rayhunter uses it there.
46+
# So we're not testing windows-gnu or linux-gnu

cargo-auditable/tests/it.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,9 +596,11 @@ fn test_bare_linker_inner(sbom: bool) {
596596
let cargo_toml =
597597
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests/fixtures/bare_linker/Cargo.toml");
598598
// The motivating example is https://github.com/EFForg/rayhunter/blob/main/.cargo/config.toml
599-
// and the config file fixture is based on that.
600-
// There doesn't seem to be a way to build with a bare linker for GNU targets, only Apple and Musl,
601-
// so this tests really only does anything on those.
599+
// and the config file fixture is based on that, with some additions.
600+
//
601+
// The config file doesn't specify a bare linker for all targets;
602+
// e.g. GNU doesn't seem to support using a bare linker at all.
603+
// See the config file for the exact list of targets where this is tested.
602604
let config_path = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
603605
.join("tests/fixtures/bare_linker/.cargo/config.toml");
604606

0 commit comments

Comments
 (0)