Skip to content

Commit c39053c

Browse files
committed
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 rust-lang/rust#65391 Signed-off-by: Daniel Egger <[email protected]>
1 parent 9214dda commit c39053c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

cortex-m-rt/link.x.in

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,29 +88,32 @@ SECTIONS
8888
*(.text .text.*);
8989
*(.HardFaultTrampoline);
9090
*(.HardFault.*);
91+
. = ALIGN(4);
92+
__etext = .;
9193
} > FLASH
9294

9395
/* ### .rodata */
94-
.rodata : ALIGN(4)
96+
.rodata __etext : ALIGN(4)
9597
{
9698
*(.rodata .rodata.*);
9799

98100
/* 4-byte align the end (VMA) of this section.
99101
This is required by LLD to ensure the LMA of the following .data
100102
section will have the correct alignment. */
101103
. = ALIGN(4);
104+
__erodata = .;
102105
} > FLASH
103106

104107
/* ## Sections in RAM */
105108
/* ### .data */
106-
.data : ALIGN(4)
109+
.data : AT(__erodata) ALIGN(4)
107110
{
108111
. = ALIGN(4);
109112
__sdata = .;
110113
*(.data .data.*);
111114
. = ALIGN(4); /* 4-byte align the end (VMA) of this section */
112115
__edata = .;
113-
} > RAM AT > FLASH
116+
} > RAM
114117

115118
/* LMA of .data */
116119
__sidata = LOADADDR(.data);

0 commit comments

Comments
 (0)