Reduce space lost to object alignment
Currently, sections within .text/.rodata/.data/.bss are emitted in the
order they are seen by the linker. This leads to wasted space, when a
section with a larger alignment follows one with a smaller alignment.
We can avoid this wasted space by sorting the sections.

To take full advantage of this, we must disable generation of common
symbols, so "common" data can be sorted along with the rest of .bss.

An example of the improvement, from `make DEBUG=1 PLAT=sun50i_a64 bl31`:
  .text   => no change
  .rodata => 16 bytes saved
  .data   => 11 bytes saved
  .bss    => 576 bytes saved

As a side effect, the addition of `-fno-common` in TF_CFLAGS makes it
easier to spot bugs in header files.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Change-Id: I073630a9b0b84e7302a7a500d4bb4b547be01d51
1 parent 118a67a commit ebd6efae67c6a086bc97d807a638bde324d936dc
@Samuel Holland Samuel Holland authored on 20 Oct 2019
Showing 6 changed files
View
Makefile
View
bl1/bl1.ld.S
View
bl2/bl2.ld.S
View
bl2/bl2_el3.ld.S
View
bl2u/bl2u.ld.S
View
bl31/bl31.ld.S