linker: __data_region_start equal to __data_start

Fixes: #38591, #38207, #37861

The commit 65a2de84a9 aligned the data
linker symbol for sections and regions.

The data region symbol start has been placed outside the sections thus
being defined as the address of the region before alignment of the first
section in the data region, usually the `datas` section.

The symbol defining the start address of the data section is after
section alignment.
In most cases the address of the data region start and datas section
start will be identical, but not always.
The data region symbol is a new linker symbol and existing code has
been depending on the old data section start symbol.
Thus, the update to the use of the data region start symbol instead of
data ram start symbol thus results in a different address when the
section is aligned to a different address.

To ensure the original behavior in all cases, the data region start
address is now moved inside the data section.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2021-09-23 22:36:09 +02:00 committed by Christopher Friedt
commit 15e834a687
7 changed files with 7 additions and 13 deletions

View file

@ -173,11 +173,10 @@ SECTIONS {
GROUP_START(DATA_REGION)
__data_region_start = .;
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,) {
/* when XIP, .text is in ROM, but vector table must be at start of .data */
__data_region_start = .;
__data_start = .;
*(".data")
*(".data.*")

View file

@ -278,10 +278,9 @@ SECTIONS
#include <linker/common-noinit.ld>
__data_region_start = .;
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
{
__data_region_start = .;
__data_start = .;
*(.data)
*(".data.*")

View file

@ -294,10 +294,9 @@ SECTIONS
GROUP_START(DATA_REGION)
__data_region_start = .;
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
{
__data_region_start = .;
__data_start = .;
*(.data)
*(".data.*")

View file

@ -248,10 +248,9 @@ SECTIONS
#include <linker/common-noinit.ld>
__data_region_start = .;
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
{
__data_region_start = .;
__data_start = .;
*(.data)
*(".data.*")

View file

@ -229,12 +229,11 @@ SECTIONS
#include <linker/common-noinit.ld>
#include <linker/cplusplus-ram.ld>
__data_region_start = .;
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
{
. = ALIGN(4);
/* _image_ram_start = .; */
__data_region_start = .;
__data_start = .;
*(.data)

View file

@ -68,7 +68,6 @@ SECTIONS
__rom_region_end = .;
__data_region_load_start = .;
__data_region_start = .;
SECTION_PROLOGUE(.plt,,)
@ -85,6 +84,7 @@ SECTIONS
{
. = ALIGN(8);
_image_ram_start = .;
__data_region_start = .;
__data_start = .;
*(.data)

View file

@ -159,12 +159,11 @@ SECTIONS
GROUP_START(RAM)
__data_region_start = .;
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
{
. = ALIGN(4);
_image_ram_start = .;
__data_region_start = .;
__data_start = .;
*(.data)