embedded-test-linker-script

Crates.ioembedded-test-linker-script
lib.rsembedded-test-linker-script
version0.1.0-alpha.2
created_at2025-08-07 09:33:51.102445+00
updated_at2025-08-20 09:01:42.424609+00
descriptionLinker script for embedded-test
homepage
repositoryhttps://github.com/probe-rs/embedded-test
max_upload_size
id1784971
size4,726
Timo Lang (t-moe)

documentation

README

Embedded Test Linker Script

Linker Script for the embedded-test crate.

Allows you to write

[dependencies]
embedded-test-linker-script = { version = "0.1.0" }

[dev-dependencies]
embedded-test = { version = "0.7.0" }

instead of

[dependencies]
embedded-test = { version = "0.7.0" }

Why do we even need this?

embedded-test stores the testcases in a custom section of the ELF file and probe-rs reads that section to run the tests. This section needs to be kept by the linker, so we need a custom linker script.

Cargo provides cargo:rustc-link-arg-tests to add a linker script for all integration tests. But there is no corresponding instruction to add a linker script for bin/lib unit-tests (see issue rust-lang/10937).

As a consequence we have to use cargo:rustc-link-arg which adds the linker script unconditionally, but requires us to host at least the linker script in a crate added to [dependencies] instead of [dev-dependencies].

Commit count: 97

cargo fmt