Skip to content

Commit

Permalink
build: Use target.json to control linking
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
josephlr committed Nov 6, 2019
1 parent 5c1cb64 commit ef5f1c9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .cargo/config

This file was deleted.

2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ install:

script:
- cargo xbuild --release --target target.json
- cargo xclippy
- cargo xclippy --target target.json
- cargo clippy --all-targets --all-features
- cargo fmt --all -- --check
- cargo test
Expand Down
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ version = "0.1.0"
authors = ["Rob Bradford <[email protected]>"]
edition = "2018"

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

# the profile used for `cargo build --release`
[profile.release]
panic = "abort" # disable stack unwinding on panic
panic = "abort"
lto = true

[dependencies]
Expand Down
1 change: 1 addition & 0 deletions target.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"features": "-mmx,-sse,+soft-float",
"pre-link-args": {
"ld.lld": [
"-s",
"--script=layout.ld"
]
}
Expand Down

0 comments on commit ef5f1c9

Please sign in to comment.