From 9fb288a03ed2ced7706defbbf78f008e921e17e2 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 26 Mar 2020 10:51:39 +0900 Subject: linker_script: move more common code to bl_common.ld.h These are mostly used to collect data from special structure, and repeated in many linker scripts. To differentiate the alignment size between aarch32/aarch64, I added a new macro STRUCT_ALIGN. While I moved the PMF_SVC_DESCS, I dropped #if ENABLE_PMF conditional. As you can see in include/lib/pmf/pmf_helpers.h, PMF_REGISTER_SERVICE* are no-op when ENABLE_PMF=0. So, pmf_svc_descs and pmf_timestamp_array data are not populated. Change-Id: I3f4ab7fa18f76339f1789103407ba76bda7e56d0 Signed-off-by: Masahiro Yamada --- bl2/bl2.ld.S | 26 ++++---------------------- bl2/bl2_el3.ld.S | 56 ++++++-------------------------------------------------- 2 files changed, 10 insertions(+), 72 deletions(-) (limited to 'bl2') diff --git a/bl2/bl2.ld.S b/bl2/bl2.ld.S index d08b046e9..afb013390 100644 --- a/bl2/bl2.ld.S +++ b/bl2/bl2.ld.S @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include - #include #include @@ -47,16 +45,8 @@ SECTIONS __RODATA_START__ = .; *(SORT_BY_ALIGNMENT(.rodata*)) - . = ALIGN(8); - __FCONF_POPULATOR_START__ = .; - KEEP(*(.fconf_populator)) - __FCONF_POPULATOR_END__ = .; - - /* Ensure 8-byte alignment for descriptors and ensure inclusion */ - . = ALIGN(8); - __PARSER_LIB_DESCS_START__ = .; - KEEP(*(.img_parser_lib_descs)) - __PARSER_LIB_DESCS_END__ = .; + FCONF_POPULATOR + PARSER_LIB_DESCS . = ALIGN(PAGE_SIZE); __RODATA_END__ = .; @@ -68,16 +58,8 @@ SECTIONS *(SORT_BY_ALIGNMENT(.text*)) *(SORT_BY_ALIGNMENT(.rodata*)) - . = ALIGN(8); - __FCONF_POPULATOR_START__ = .; - KEEP(*(.fconf_populator)) - __FCONF_POPULATOR_END__ = .; - - /* Ensure 8-byte alignment for descriptors and ensure inclusion */ - . = ALIGN(8); - __PARSER_LIB_DESCS_START__ = .; - KEEP(*(.img_parser_lib_descs)) - __PARSER_LIB_DESCS_END__ = .; + FCONF_POPULATOR + PARSER_LIB_DESCS *(.vectors) __RO_END_UNALIGNED__ = .; diff --git a/bl2/bl2_el3.ld.S b/bl2/bl2_el3.ld.S index a72818c99..d23799029 100644 --- a/bl2/bl2_el3.ld.S +++ b/bl2/bl2_el3.ld.S @@ -4,8 +4,6 @@ * SPDX-License-Identifier: BSD-3-Clause */ -#include - #include #include @@ -55,30 +53,9 @@ SECTIONS __RODATA_START__ = .; *(SORT_BY_ALIGNMENT(.rodata*)) - /* Ensure 8-byte alignment for descriptors and ensure inclusion */ - . = ALIGN(8); - __PARSER_LIB_DESCS_START__ = .; - KEEP(*(.img_parser_lib_descs)) - __PARSER_LIB_DESCS_END__ = .; - - /* - * Ensure 8-byte alignment for cpu_ops so that its fields are also - * aligned. Also ensure cpu_ops inclusion. - */ - . = ALIGN(8); - __CPU_OPS_START__ = .; - KEEP(*(cpu_ops)) - __CPU_OPS_END__ = .; - - /* - * Keep the .got section in the RO section as it is patched - * prior to enabling the MMU and having the .got in RO is better for - * security. GOT is a table of addresses so ensure 8-byte alignment. - */ - . = ALIGN(8); - __GOT_START__ = .; - *(.got) - __GOT_END__ = .; + PARSER_LIB_DESCS + CPU_OPS + GOT . = ALIGN(PAGE_SIZE); __RODATA_END__ = .; @@ -96,30 +73,9 @@ SECTIONS *(SORT_BY_ALIGNMENT(.text*)) *(SORT_BY_ALIGNMENT(.rodata*)) - /* - * Ensure 8-byte alignment for cpu_ops so that its fields are also - * aligned. Also ensure cpu_ops inclusion. - */ - . = ALIGN(8); - __CPU_OPS_START__ = .; - KEEP(*(cpu_ops)) - __CPU_OPS_END__ = .; - - /* Ensure 8-byte alignment for descriptors and ensure inclusion */ - . = ALIGN(8); - __PARSER_LIB_DESCS_START__ = .; - KEEP(*(.img_parser_lib_descs)) - __PARSER_LIB_DESCS_END__ = .; - - /* - * Keep the .got section in the RO section as it is patched - * prior to enabling the MMU and having the .got in RO is better for - * security. GOT is a table of addresses so ensure 8-byte alignment. - */ - . = ALIGN(8); - __GOT_START__ = .; - *(.got) - __GOT_END__ = .; + CPU_OPS + PARSER_LIB_DESCS + GOT *(.vectors) __RO_END_UNALIGNED__ = .; -- cgit v1.2.3