diff --git a/boards/Makefile.common b/boards/Makefile.common index 1341e1a420..984c3cc35a 100644 --- a/boards/Makefile.common +++ b/boards/Makefile.common @@ -41,21 +41,10 @@ TARGET_DIRECTORY ?= $(TOCK_ROOT_DIRECTORY)target/ # This will hopefully move into Cargo.toml (or Cargo.toml.local) eventually. # # - `relocation-model=static`: See https://github.com/tock/tock/pull/2853 -# - `-nmagic`: lld by default uses a default page size to align program -# sections. Tock expects that program sections are set back-to-back. `-nmagic` -# instructs the linker to not page-align sections. -# - `-icf=all`: Identical Code Folding (ICF) set to all. This tells the linker -# to be more aggressive about removing duplicate code. The default is `safe`, -# and the downside to `all` is that different functions in the code can end up -# with the same address in the binary. However, it can save a fair bit of code -# size. RUSTC_FLAGS ?= \ - -C link-arg=-Tlayout.ld \ -C linker=rust-lld \ -C linker-flavor=ld.lld \ -C relocation-model=static \ - -C link-arg=-nmagic \ - -C link-arg=-icf=all \ # RISC-V-specific flags. ifneq ($(findstring riscv32i, $(TARGET)),) diff --git a/boards/hail/build.rs b/boards/hail/build.rs index 46b1df0bac..0ab8114e3d 100644 --- a/boards/hail/build.rs +++ b/boards/hail/build.rs @@ -1,5 +1,10 @@ +#[path = "../common_build.rs"] +mod common_build; + fn main() { println!("cargo:rerun-if-changed=layout.ld"); println!("cargo:rerun-if-changed=chip_layout.ld"); println!("cargo:rerun-if-changed=../kernel_layout.ld"); + + common_build::tock_default_linker_args(); }