Skip to content

Commit ef5f1c9

Browse files
committed
build: Use target.json to control linking
Right now we use Cargo files to strip the binary and remove panic-based stack unwinding. However, these are necessary due to the nature of our _target_, so the target file should set these options. Signed-off-by: Joe Richey <[email protected]>
1 parent 5c1cb64 commit ef5f1c9

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

.cargo/config

Lines changed: 0 additions & 2 deletions
This file was deleted.

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ install:
2222

2323
script:
2424
- cargo xbuild --release --target target.json
25-
- cargo xclippy
25+
- cargo xclippy --target target.json
2626
- cargo clippy --all-targets --all-features
2727
- cargo fmt --all -- --check
2828
- cargo test

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ version = "0.1.0"
44
authors = ["Rob Bradford <[email protected]>"]
55
edition = "2018"
66

7-
# the profile used for `cargo build`
7+
# Despite "panic-strategy": "abort" being set in target.json, panic = "abort" is
8+
# needed here to make "cargo check" and "cargo clippy" run without errors.
89
[profile.dev]
9-
panic = "abort" # disable stack unwinding on panic
10+
panic = "abort"
1011
lto = true
1112

12-
# the profile used for `cargo build --release`
1313
[profile.release]
14-
panic = "abort" # disable stack unwinding on panic
14+
panic = "abort"
1515
lto = true
1616

1717
[dependencies]

target.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"features": "-mmx,-sse,+soft-float",
1515
"pre-link-args": {
1616
"ld.lld": [
17+
"-s",
1718
"--script=layout.ld"
1819
]
1920
}

0 commit comments

Comments
 (0)