diff options
author | Julius Werner <jwerner@chromium.org> | 2013-10-15 17:36:17 -0700 |
---|---|---|
committer | Isaac Christensen <isaac.christensen@se-eng.com> | 2014-09-22 18:41:54 +0200 |
commit | c505837e67aa4fb89964c849d905fa8d44459152 (patch) | |
tree | f7e18fbcb50e54509c3a2a6365cf9a3365dfde67 /src/arch/arm/bootblock.ld | |
parent | 08539b3b986a1eb564815f72897b448e2bd69b5b (diff) |
arm: Have the linker garbage-collect unused functions and variables
This patch activates -ffunction-sections and -fdata-sections for the
compiler and --gc-sections for the linker. This will strip out all
unused functions and static/global variables from the final binaries and
reduce the amount of data we need to read over SPI.
A quick test with ToT images shows a 2.5k (13%) / 10k (29%) / 12k (28%)
reduction on Nyan and 3k (38%) / 23k (50%) / 13k (29%) on Pit,
respectively for bootblock / romstage / ramstage.
Change-Id: I052411d4ad190d0395921ac4d4677341fb91568a
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/177111
(cherry picked from commit 5635b138778dea67a5f179e13003132be07f7e59)
Signed-off-by: Isaac Christensen <isaac.christensen@se-eng.com>
Reviewed-on: http://review.coreboot.org/6904
Tested-by: build bot (Jenkins)
Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'src/arch/arm/bootblock.ld')
-rw-r--r-- | src/arch/arm/bootblock.ld | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/arch/arm/bootblock.ld b/src/arch/arm/bootblock.ld index 706f0a2c2e..2b04b22475 100644 --- a/src/arch/arm/bootblock.ld +++ b/src/arch/arm/bootblock.ld @@ -28,23 +28,25 @@ PHDRS to_load PT_LOAD; } +ENTRY(_start) TARGET(binary) SECTIONS { - ROMLOC = CONFIG_BOOTBLOCK_BASE; + . = CONFIG_BOOTBLOCK_BASE; - /* This section might be better named .setup */ - .rom ROMLOC : { - _rom = .; + .bootblock . : { *(.start); - *(.id); + KEEP(*(.id)); *(.text); *(.text.*); - *(.rom.text); - *(.rom.data); - *(.rom.data.*); + *(.rodata); *(.rodata.*); - _erom = .; + *(.data); + *(.data.*); + *(.bss); + *(.bss.*); + *(.sbss); + *(.sbss.*); } : to_load = 0xff /DISCARD/ : { @@ -54,4 +56,4 @@ SECTIONS *(.note.*) *(.ARM.*) } -} +}
\ No newline at end of file |