From d5f2a94d23e921a26350f9d7ba79af3cf8e6bbab 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 --- link.x.in | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/link.x.in b/link.x.in index 1d05f16b..30d4af10 100644 --- a/link.x.in +++ b/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);