aboutsummaryrefslogtreecommitdiffstats
path: root/src/arch/arm/ramstage.ld
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2013-10-15 17:36:17 -0700
committerIsaac Christensen <isaac.christensen@se-eng.com>2014-09-22 18:41:54 +0200
commitc505837e67aa4fb89964c849d905fa8d44459152 (patch)
treef7e18fbcb50e54509c3a2a6365cf9a3365dfde67 /src/arch/arm/ramstage.ld
parent08539b3b986a1eb564815f72897b448e2bd69b5b (diff)
downloadcoreboot-c505837e67aa4fb89964c849d905fa8d44459152.tar.gz
coreboot-c505837e67aa4fb89964c849d905fa8d44459152.tar.xz
coreboot-c505837e67aa4fb89964c849d905fa8d44459152.zip
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/ramstage.ld')
-rw-r--r--src/arch/arm/ramstage.ld20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/arch/arm/ramstage.ld b/src/arch/arm/ramstage.ld
index cab512e99..5469509b8 100644
--- a/src/arch/arm/ramstage.ld
+++ b/src/arch/arm/ramstage.ld
@@ -48,7 +48,7 @@ SECTIONS
.ctors : {
. = ALIGN(0x100);
__CTOR_LIST__ = .;
- *(.ctors);
+ KEEP(*(.ctors));
LONG(0);
__CTOR_END__ = .;
}
@@ -57,13 +57,13 @@ SECTIONS
_rodata = .;
. = ALIGN(4);
pci_drivers = . ;
- *(.rodata.pci_driver)
+ KEEP(*(.rodata.pci_driver));
epci_drivers = . ;
cpu_drivers = . ;
- *(.rodata.cpu_driver)
+ KEEP(*(.rodata.cpu_driver));
ecpu_drivers = . ;
_bs_init_begin = .;
- *(.bs_init)
+ KEEP(*(.bs_init));
_bs_init_end = .;
*(.rodata)
*(.rodata.*)
@@ -83,6 +83,7 @@ SECTIONS
.data : {
_data = .;
*(.data)
+ *(.data.*)
_edata = .;
}
@@ -90,26 +91,27 @@ SECTIONS
* initialized on startup. (typically uninitialized global variables)
* crt0.S fills between _bss and _ebss with zeroes.
*/
- _bss = .;
.bss . : {
+ _bss = .;
*(.bss)
+ *(.bss.*)
*(.sbss)
- *(COMMON)
+ *(.sbss.*)
+ _ebss = .;
}
- _ebss = .;
_end = .;
/* coreboot really "ends" here. Only heap and stack are placed after
* this line.
*/
- _heap = .;
.heap . : {
+ _heap = .;
/* Reserve CONFIG_HEAP_SIZE bytes for the heap */
. = CONFIG_HEAP_SIZE ;
. = ALIGN(4);
+ _eheap = .;
}
- _eheap = .;
/* The ram segment. This includes all memory used by the memory
* resident copy of coreboot, except the tables that are produced on