Sort .text section to reduce fill

This commit is contained in:
Scott Shawcroft 2021-08-31 18:04:01 -07:00
parent ec067ae728
commit cd5acae4f4
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
1 changed files with 9 additions and 5 deletions

View File

@ -27,8 +27,12 @@ SECTIONS
. = ALIGN(4);
_sfixed = .;
KEEP(*(.vectors)) /* isr vector table */
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
/* Sort text sections so that they have fewer *fill* bytes needed. */
*SORT_BY_ALIGNMENT(SORT_BY_NAME(.text)) /* .text sections (code) */
*SORT_BY_ALIGNMENT(SORT_BY_NAME(.text*)) /* .text* sections (code) */
/* Don't sort rodata because it impacts codegen size. */
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
@ -62,8 +66,8 @@ SECTIONS
_srelocate = .; /* create a global symbol at data start; used by startup code in order to initialize the .data section in RAM */
*(.ramfunc)
*(.ramfunc*)
*(.data) /* .data sections */
*(.data*) /* .data* sections */
*SORT_BY_ALIGNMENT(SORT_BY_NAME(.data)) /* .data sections */
*SORT_BY_ALIGNMENT(SORT_BY_NAME(.data*)) /* .data* sections */
. = ALIGN(4);
_erelocate = .; /* define a global symbol at data end; used by startup code in order to initialize the .data section in RAM */
@ -76,7 +80,7 @@ SECTIONS
_sbss = .;
_szero = .; /* define a global symbol at bss start; used by startup code */
*(.bss)
*(.bss*)
*SORT_BY_ALIGNMENT(SORT_BY_NAME(.bss*))
*(COMMON)
. = ALIGN(4);