From 268131c24fedb804589a2226d4adb3ef97cd8874 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Thu, 26 Mar 2020 13:18:48 +0900 Subject: [PATCH] xlat_tables_v2: fix assembler warning of PLAT_RO_XLAT_TABLES If PLAT_RO_XLAT_TABLES is defined, the base xlat table goes to the .rodata section instead of .bss section. This causes a warning like: /tmp/ccswitLr.s: Assembler messages: /tmp/ccswitLr.s:297: Warning: setting incorrect section attributes for .rodata It is practically no problem, but I want to keep the build log clean. Put the base table into the "base_xlat_table" section to suppress the assembler warnings. The linker script determines its final destination; rodata section if PLAT_RO_XLAT_TABLES=1, or bss section otherwise. So, the result is the same. Change-Id: Ic85d1d2dddd9b5339289fc2378cbcb21dd7db02e Signed-off-by: Masahiro Yamada --- include/common/bl_common.ld.h | 22 +++++++++++++++++++++- include/lib/xlat_tables/xlat_tables_v2.h | 9 ++------- lib/xlat_tables_v2/xlat_tables_context.c | 9 +-------- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/include/common/bl_common.ld.h b/include/common/bl_common.ld.h index 3fc8e970d..8ea7d6a8c 100644 --- a/include/common/bl_common.ld.h +++ b/include/common/bl_common.ld.h @@ -58,13 +58,32 @@ *(.got) \ __GOT_END__ = .; +/* + * The base xlat table + * + * It is put into the rodata section if PLAT_RO_XLAT_TABLES=1, + * or into the bss section otherwise. + */ +#define BASE_XLAT_TABLE \ + . = ALIGN(16); \ + *(base_xlat_table) + +#if PLAT_RO_XLAT_TABLES +#define BASE_XLAT_TABLE_RO BASE_XLAT_TABLE +#define BASE_XLAT_TABLE_BSS +#else +#define BASE_XLAT_TABLE_RO +#define BASE_XLAT_TABLE_BSS BASE_XLAT_TABLE +#endif + #define RODATA_COMMON \ RT_SVC_DESCS \ FCONF_POPULATOR \ PMF_SVC_DESCS \ PARSER_LIB_DESCS \ CPU_OPS \ - GOT + GOT \ + BASE_XLAT_TABLE_RO #define STACK_SECTION \ stacks (NOLOAD) : { \ @@ -142,6 +161,7 @@ *(COMMON) \ BAKERY_LOCK_NORMAL \ PMF_TIMESTAMP \ + BASE_XLAT_TABLE_BSS \ __BSS_END__ = .; \ } diff --git a/include/lib/xlat_tables/xlat_tables_v2.h b/include/lib/xlat_tables/xlat_tables_v2.h index ab311f4cb..9fe4a6e8a 100644 --- a/include/lib/xlat_tables/xlat_tables_v2.h +++ b/include/lib/xlat_tables/xlat_tables_v2.h @@ -164,20 +164,15 @@ typedef struct xlat_ctx xlat_ctx_t; * Would typically be PLAT_VIRT_ADDR_SPACE_SIZE * (resp. PLAT_PHY_ADDR_SPACE_SIZE) for the translation context describing the * BL image currently executing. - - * _base_table_section: - * Specify the name of the section where the base translation tables have to - * be placed by the linker. */ #define REGISTER_XLAT_CONTEXT(_ctx_name, _mmap_count, _xlat_tables_count, \ - _virt_addr_space_size, _phy_addr_space_size, \ - _base_table_section) \ + _virt_addr_space_size, _phy_addr_space_size) \ REGISTER_XLAT_CONTEXT_FULL_SPEC(_ctx_name, (_mmap_count), \ (_xlat_tables_count), \ (_virt_addr_space_size), \ (_phy_addr_space_size), \ EL_REGIME_INVALID, \ - "xlat_table", (_base_table_section)) + "xlat_table", "base_xlat_table") /* * Same as REGISTER_XLAT_CONTEXT plus the additional parameters: diff --git a/lib/xlat_tables_v2/xlat_tables_context.c b/lib/xlat_tables_v2/xlat_tables_context.c index 032e1424f..95dae88eb 100644 --- a/lib/xlat_tables_v2/xlat_tables_context.c +++ b/lib/xlat_tables_v2/xlat_tables_context.c @@ -25,15 +25,8 @@ uint64_t mmu_cfg_params[MMU_CFG_PARAM_MAX]; * Allocate and initialise the default translation context for the BL image * currently executing. */ -#if PLAT_RO_XLAT_TABLES -#define BASE_XLAT_TABLE_SECTION ".rodata" -#else -#define BASE_XLAT_TABLE_SECTION ".bss" -#endif - REGISTER_XLAT_CONTEXT(tf, MAX_MMAP_REGIONS, MAX_XLAT_TABLES, - PLAT_VIRT_ADDR_SPACE_SIZE, PLAT_PHY_ADDR_SPACE_SIZE, - BASE_XLAT_TABLE_SECTION); + PLAT_VIRT_ADDR_SPACE_SIZE, PLAT_PHY_ADDR_SPACE_SIZE); void mmap_add_region(unsigned long long base_pa, uintptr_t base_va, size_t size, unsigned int attr)