Skip to content

Commit

Permalink
Rejig link.x to include more lables to help the linker lay out the ob…
Browse files Browse the repository at this point in the history
…jects

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 rust-embedded#188 (I believe)
Closes rust-lang/rust#65391

Signed-off-by: Daniel Egger <daniel@eggers-club.de>
  • Loading branch information
therealprof committed Oct 22, 2019
1 parent 965bf1e commit 16e8b52
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions link.x.in
Original file line number Diff line number Diff line change
Expand Up @@ -88,29 +88,32 @@ SECTIONS
*(.text .text.*);
*(.HardFaultTrampoline);
*(.HardFault.*);
. = ALIGN(4);
__etext = .;
} > FLASH

/* ### .rodata */
.rodata : ALIGN(4)
.rodata __etext: ALIGN(4)
{
*(.rodata .rodata.*);

/* 4-byte align the end (VMA) of this section.
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);
Expand Down

0 comments on commit 16e8b52

Please sign in to comment.