@@ -65,7 +65,7 @@ where in memory does this section go?
6565This is where things break down. Multiple linkers exhibit different behavior,
6666and the rules seem to be pretty complex, depending on whether any PHDRS have
6767been explicitly declared, and whether any MEMORY nodes are present in the linker
68- script.
68+ script.[ ^ 1 ]
6969
7070For a long time, the issue went unnoticed since the section was placed in RAM, which was the
7171intended behavior. However, at some point, the section was placed in FLASH instead, causing the
@@ -227,7 +227,7 @@ section is allocated, has the right size of 0.
227227## How can we make the linker script more robust?
228228
229229After finding this issue, I looked for a way to detect this kind of problem,
230- ideally at compile-time. I found the ` --orphaned-handling ` flag of the ` ld ` and ` lld ` linkers[ ^ 1 ] .
230+ ideally at compile-time. I found the ` --orphaned-handling ` flag of the ` ld ` and ` lld ` linkers[ ^ 2 ] .
231231This flag allows us to specify what should be the behavior when an orphaned
232232section is encountered. You have the following options:
233233
@@ -280,5 +280,9 @@ to your linker script.
280280 }
281281```
282282
283- [ ^ 1 ] : You can find the ld documentation for orphaned sections
283+ [ ^ 1 ] : MaskRay has a great [ article] ( https://maskray.me/blog/2024-06-02-understanding-orphan-sections )
284+ describing some of these placement rules for both ld and lld, if you would like to go deeper into
285+ this topic.
286+
287+ [ ^ 2 ] : You can find the ld documentation for orphaned sections
284288[ here] ( https://sourceware.org/binutils/docs/ld/Orphan-Sections.html ) .
0 commit comments