From c39053c87fa809b3505088fff0d936205386b534 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 22 Oct 2019 22:42:20 +0200 Subject: [PATCH] Rejig link.x to include more lables to help the linker lay out the objects Tested with 1.34.0 and 1.38.0 and careful inspection of the linker map generated on the previously failing https://github.com/rust-lang/rust/files/3722440/minimal-rust-lld-issue.zip Closes #188 (I believe) Closes https://github.com/rust-lang/rust/issues/65391 Signed-off-by: Daniel Egger --- cortex-m-rt/link.x.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cortex-m-rt/link.x.in b/cortex-m-rt/link.x.in index 1d05f16b..30d4af10 100644 --- a/cortex-m-rt/link.x.in +++ b/cortex-m-rt/link.x.in @@ -88,10 +88,12 @@ SECTIONS *(.text .text.*); *(.HardFaultTrampoline); *(.HardFault.*); + . = ALIGN(4); + __etext = .; } > FLASH /* ### .rodata */ - .rodata : ALIGN(4) + .rodata __etext : ALIGN(4) { *(.rodata .rodata.*); @@ -99,18 +101,19 @@ SECTIONS This is required by LLD to ensure the LMA of the following .data section will have the correct alignment. */ . = ALIGN(4); + __erodata = .; } > FLASH /* ## Sections in RAM */ /* ### .data */ - .data : ALIGN(4) + .data : AT(__erodata) ALIGN(4) { . = ALIGN(4); __sdata = .; *(.data .data.*); . = ALIGN(4); /* 4-byte align the end (VMA) of this section */ __edata = .; - } > RAM AT > FLASH + } > RAM /* LMA of .data */ __sidata = LOADADDR(.data);