Commit 0a0a7a9a authored by Masahiro Yamada's avatar Masahiro Yamada
Browse files

linker_script: replace common read-only data with RODATA_COMMON

The common section data are repeated in many linker scripts (often
twice in each script to support SEPARATE_CODE_AND_RODATA). When you
add a new read-only data section, you end up with touching lots of
places.

After this commit, you will only need to touch bl_common.ld.h when
you add a new section to RODATA_COMMON.

Replace a series of RO section with RODATA_COMMON, which contains
6 sections, some of which did not exist before.

This is not a big deal because unneeded data should not be compiled
in the first place. I believe this should be controlled by BL*_SOURCES
in Makefiles, not by linker scripts.

When I was working on this commit, the BL1 image size increased
due to the fconf_populator. Commit c452ba15

 ("fconf: exclude
fconf_dyn_cfg_getter.c from BL1_SOURCES") fixed this issue.

I investigated BL1, BL2, BL2U, BL31 for plat=fvp, and BL2-AT-EL3,
BL31, BL31 for plat=uniphier. I did not see any more  unexpected
code addition.

Change-Id: I5d14d60dbe3c821765bce3ae538968ef266f1460
Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
parent 9fb288a0
...@@ -45,8 +45,7 @@ SECTIONS ...@@ -45,8 +45,7 @@ SECTIONS
__RODATA_START__ = .; __RODATA_START__ = .;
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
PARSER_LIB_DESCS RODATA_COMMON
CPU_OPS
/* /*
* No need to pad out the .rodata section to a page boundary. Next is * No need to pad out the .rodata section to a page boundary. Next is
...@@ -67,8 +66,7 @@ SECTIONS ...@@ -67,8 +66,7 @@ SECTIONS
*(SORT_BY_ALIGNMENT(.text*)) *(SORT_BY_ALIGNMENT(.text*))
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
PARSER_LIB_DESCS RODATA_COMMON
CPU_OPS
*(.vectors) *(.vectors)
__RO_END__ = .; __RO_END__ = .;
......
...@@ -45,8 +45,7 @@ SECTIONS ...@@ -45,8 +45,7 @@ SECTIONS
__RODATA_START__ = .; __RODATA_START__ = .;
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
FCONF_POPULATOR RODATA_COMMON
PARSER_LIB_DESCS
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
__RODATA_END__ = .; __RODATA_END__ = .;
...@@ -58,8 +57,7 @@ SECTIONS ...@@ -58,8 +57,7 @@ SECTIONS
*(SORT_BY_ALIGNMENT(.text*)) *(SORT_BY_ALIGNMENT(.text*))
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
FCONF_POPULATOR RODATA_COMMON
PARSER_LIB_DESCS
*(.vectors) *(.vectors)
__RO_END_UNALIGNED__ = .; __RO_END_UNALIGNED__ = .;
......
...@@ -53,9 +53,7 @@ SECTIONS ...@@ -53,9 +53,7 @@ SECTIONS
__RODATA_START__ = .; __RODATA_START__ = .;
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
PARSER_LIB_DESCS RODATA_COMMON
CPU_OPS
GOT
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
__RODATA_END__ = .; __RODATA_END__ = .;
...@@ -73,9 +71,7 @@ SECTIONS ...@@ -73,9 +71,7 @@ SECTIONS
*(SORT_BY_ALIGNMENT(.text*)) *(SORT_BY_ALIGNMENT(.text*))
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
CPU_OPS RODATA_COMMON
PARSER_LIB_DESCS
GOT
*(.vectors) *(.vectors)
__RO_END_UNALIGNED__ = .; __RO_END_UNALIGNED__ = .;
......
...@@ -46,6 +46,9 @@ SECTIONS ...@@ -46,6 +46,9 @@ SECTIONS
.rodata . : { .rodata . : {
__RODATA_START__ = .; __RODATA_START__ = .;
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
RODATA_COMMON
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
__RODATA_END__ = .; __RODATA_END__ = .;
} >RAM } >RAM
...@@ -56,6 +59,8 @@ SECTIONS ...@@ -56,6 +59,8 @@ SECTIONS
*(SORT_BY_ALIGNMENT(.text*)) *(SORT_BY_ALIGNMENT(.text*))
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
RODATA_COMMON
*(.vectors) *(.vectors)
__RO_END_UNALIGNED__ = .; __RO_END_UNALIGNED__ = .;
/* /*
......
...@@ -47,11 +47,7 @@ SECTIONS ...@@ -47,11 +47,7 @@ SECTIONS
__RODATA_START__ = .; __RODATA_START__ = .;
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
RT_SVC_DESCS RODATA_COMMON
FCONF_POPULATOR
PMF_SVC_DESCS
CPU_OPS
GOT
/* Place pubsub sections for events */ /* Place pubsub sections for events */
. = ALIGN(8); . = ALIGN(8);
...@@ -67,11 +63,7 @@ SECTIONS ...@@ -67,11 +63,7 @@ SECTIONS
*(SORT_BY_ALIGNMENT(.text*)) *(SORT_BY_ALIGNMENT(.text*))
*(SORT_BY_ALIGNMENT(.rodata*)) *(SORT_BY_ALIGNMENT(.rodata*))
RT_SVC_DESCS RODATA_COMMON
FCONF_POPULATOR
PMF_SVC_DESCS
CPU_OPS
GOT
/* Place pubsub sections for events */ /* Place pubsub sections for events */
. = ALIGN(8); . = ALIGN(8);
......
...@@ -48,10 +48,7 @@ SECTIONS ...@@ -48,10 +48,7 @@ SECTIONS
__RODATA_START__ = .; __RODATA_START__ = .;
*(.rodata*) *(.rodata*)
RT_SVC_DESCS RODATA_COMMON
FCONF_POPULATOR
PMF_SVC_DESCS
CPU_OPS
/* Place pubsub sections for events */ /* Place pubsub sections for events */
. = ALIGN(8); . = ALIGN(8);
...@@ -67,9 +64,7 @@ SECTIONS ...@@ -67,9 +64,7 @@ SECTIONS
*(.text*) *(.text*)
*(.rodata*) *(.rodata*)
RT_SVC_DESCS RODATA_COMMON
FCONF_POPULATOR
CPU_OPS
/* Place pubsub sections for events */ /* Place pubsub sections for events */
. = ALIGN(8); . = ALIGN(8);
......
...@@ -37,7 +37,7 @@ SECTIONS ...@@ -37,7 +37,7 @@ SECTIONS
__RODATA_START__ = .; __RODATA_START__ = .;
*(.rodata*) *(.rodata*)
GOT RODATA_COMMON
. = ALIGN(PAGE_SIZE); . = ALIGN(PAGE_SIZE);
__RODATA_END__ = .; __RODATA_END__ = .;
...@@ -49,7 +49,7 @@ SECTIONS ...@@ -49,7 +49,7 @@ SECTIONS
*(.text*) *(.text*)
*(.rodata*) *(.rodata*)
GOT RODATA_COMMON
*(.vectors) *(.vectors)
......
...@@ -56,6 +56,14 @@ ...@@ -56,6 +56,14 @@
*(.got) \ *(.got) \
__GOT_END__ = .; __GOT_END__ = .;
#define RODATA_COMMON \
RT_SVC_DESCS \
FCONF_POPULATOR \
PMF_SVC_DESCS \
PARSER_LIB_DESCS \
CPU_OPS \
GOT
#define STACK_SECTION \ #define STACK_SECTION \
stacks (NOLOAD) : { \ stacks (NOLOAD) : { \
__STACKS_START__ = .; \ __STACKS_START__ = .; \
......
...@@ -38,8 +38,7 @@ SECTIONS ...@@ -38,8 +38,7 @@ SECTIONS
*(.text*) *(.text*)
*(.rodata*) *(.rodata*)
RT_SVC_DESCS RODATA_COMMON
CPU_OPS
__RO_END_UNALIGNED__ = .; __RO_END_UNALIGNED__ = .;
/* /*
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment