arch: arm: aarch32: fix section alignment behind rodata region start marker

Fix for issue 39978. This commit assigns the __rodata_region_start marker
to the ROMABLE region prior to the inclusion of linker/common-rom.ld,
linker/thread-local-storage.ld and linker/cplusplus-rom.ld. Prior to this
fix, the __rodata_region_start marker was properly aligned and indicated
the expected memory location for the start of the rodata section and
similar sections, but it was disconnected from the ROMABLE region into
which the subsequent sections are being integrated, resulting in placement
of those sections right behind the previous section in the ROMABLE region
and therefore at addresses below the __rodata_region_start marker.

For the sake of consistent behaviour, the end marker of the text region
has been modified accordingly.

Signed-off-by: Immo Birnbaum <Immo.Birnbaum@weidmueller.com>
This commit is contained in:
Immo Birnbaum 2021-12-10 15:28:42 +01:00 committed by Maureen Helm
commit 131a5dfd62

View file

@ -62,7 +62,7 @@ _region_min_align = CONFIG_ARM_MPU_REGION_MIN_ALIGN_AND_SIZE;
#elif defined(CONFIG_ARM_AARCH32_MMU)
_region_min_align = CONFIG_MMU_PAGE_SIZE;
#else
/* If building without MPU support, use default 4-byte alignment. */
/* If building without MPU/MMU support, use default 4-byte alignment. */
_region_min_align = 4;
#endif
@ -151,11 +151,10 @@ SECTIONS
*/
*(.glue_7t) *(.glue_7) *(.vfp11_veneer) *(.v4_bx)
__text_region_end = .;
. = ALIGN(_region_min_align);
} GROUP_LINK_IN(ROMABLE_REGION)
__text_region_end = .;
. = ALIGN(_region_min_align);
#if defined (CONFIG_CPLUSPLUS)
SECTION_PROLOGUE(.ARM.extab,,)
{
@ -181,8 +180,11 @@ SECTIONS
__exidx_end = .;
} GROUP_LINK_IN(ROMABLE_REGION)
. = ALIGN(_region_min_align);
__rodata_region_start = .;
SECTION_PROLOGUE(rodata_start,,)
{
. = ALIGN(_region_min_align);
__rodata_region_start = .;
} GROUP_LINK_IN(ROMABLE_REGION)
#include <linker/common-rom.ld>
#include <linker/thread-local-storage.ld>