Skip to content

Commit 7a81542

Browse files
committed
picolibc.ld.in: use separate sections for .rodata and .data.rel.ro
Having these be separate makes it easier to look at binary and see which sections contribute to total binary size. Additionally, it would allow for a correct PT_GNU_RELRO if picolibc.ld were to grow PIC support in the future. This should not have any effect on the final binary layout, it only adds two more ELF section headers.
1 parent 2c09056 commit 7a81542

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

picolibc.ld.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ SECTIONS
7575
PROVIDE (__etext = __text_end);
7676
PROVIDE (_etext = __text_end);
7777
PROVIDE (etext = __text_end);
78+
} >flash AT>flash :text
7879

80+
.rodata : {
7981
/* read-only data */
8082
*(.rdata)
8183
*(.rodata .rodata.*)
@@ -86,6 +88,9 @@ SECTIONS
8688
*(.srodata.cst4)
8789
*(.srodata.cst2)
8890
*(.srodata .srodata.*)
91+
} >flash AT>flash :text
92+
93+
.data.rel.ro : {
8994
*(.data.rel.ro .data.rel.ro.*)
9095

9196
/* Need to pre-align so that the symbols come after padding */

0 commit comments

Comments
 (0)