Skip to content

build: improve linker script and target settings #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
7 changes: 3 additions & 4 deletions layout.ld
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@ SECTIONS
/* Mapping in the program headers makes it easier to mmap the whole file. */
. += SIZEOF_HEADERS ;

.rodata : { *(.rodata .rodata.*) } :rodata
.data : { *(.data .data.*) } :data
.bss : { *(.bss .bss.*) } :data
.text : { *(.text .text.*) } :text
.rodata : { *(.rodata .rodata.*) } :rodata
.data : { *(.data .data.*) *(.bss .bss.*) } :data
.text : { *(.text .text.*) } :text

_end_of_file = . ;

Expand Down
4 changes: 4 additions & 0 deletions target.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,12 @@
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float",
"dynamic-linking-available": false,
"code-model": "small",
"relocation-model": "static",
"pre-link-args": {
"ld.lld": [
"-s",
"--script=layout.ld"
]
}
Expand Down