@@ -65,7 +65,7 @@ where in memory does this section go?
65
65
This is where things break down. Multiple linkers exhibit different behavior,
66
66
and the rules seem to be pretty complex, depending on whether any PHDRS have
67
67
been explicitly declared, and whether any MEMORY nodes are present in the linker
68
- script.
68
+ script.[ ^ 1 ]
69
69
70
70
For a long time, the issue went unnoticed since the section was placed in RAM, which was the
71
71
intended 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.
227
227
## How can we make the linker script more robust?
228
228
229
229
After 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 ] .
231
231
This flag allows us to specify what should be the behavior when an orphaned
232
232
section is encountered. You have the following options:
233
233
@@ -280,5 +280,9 @@ to your linker script.
280
280
}
281
281
```
282
282
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
284
288
[ here] ( https://sourceware.org/binutils/docs/ld/Orphan-Sections.html ) .
0 commit comments