Skip to content

Commit 15e834a

Browse files
tejlmandcfriedt
authored andcommitted
linker: __data_region_start equal to __data_start
Fixes: #38591, #38207, #37861 The commit 65a2de8 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 <[email protected]>
1 parent 18c9dfd commit 15e834a

File tree

7 files changed

+7
-13
lines changed

7 files changed

+7
-13
lines changed

include/arch/arc/v2/linker.ld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,11 +173,10 @@ SECTIONS {
173173

174174
GROUP_START(DATA_REGION)
175175

176-
__data_region_start = .;
177-
178176
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,) {
179177

180178
/* when XIP, .text is in ROM, but vector table must be at start of .data */
179+
__data_region_start = .;
181180
__data_start = .;
182181
*(".data")
183182
*(".data.*")

include/arch/arm/aarch32/cortex_a_r/scripts/linker.ld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,10 +278,9 @@ SECTIONS
278278

279279
#include <linker/common-noinit.ld>
280280

281-
__data_region_start = .;
282-
283281
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
284282
{
283+
__data_region_start = .;
285284
__data_start = .;
286285
*(.data)
287286
*(".data.*")

include/arch/arm/aarch32/cortex_m/scripts/linker.ld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,9 @@ SECTIONS
294294

295295
GROUP_START(DATA_REGION)
296296

297-
__data_region_start = .;
298-
299297
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
300298
{
299+
__data_region_start = .;
301300
__data_start = .;
302301
*(.data)
303302
*(".data.*")

include/arch/arm64/scripts/linker.ld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,9 @@ SECTIONS
248248

249249
#include <linker/common-noinit.ld>
250250

251-
__data_region_start = .;
252-
253251
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
254252
{
253+
__data_region_start = .;
255254
__data_start = .;
256255
*(.data)
257256
*(".data.*")

include/arch/riscv/common/linker.ld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,12 +229,11 @@ SECTIONS
229229
#include <linker/common-noinit.ld>
230230
#include <linker/cplusplus-ram.ld>
231231

232-
__data_region_start = .;
233-
234232
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
235233
{
236234
. = ALIGN(4);
237235
/* _image_ram_start = .; */
236+
__data_region_start = .;
238237
__data_start = .;
239238

240239
*(.data)

include/arch/sparc/linker.ld

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ SECTIONS
6868
__rom_region_end = .;
6969

7070
__data_region_load_start = .;
71-
__data_region_start = .;
7271

7372

7473
SECTION_PROLOGUE(.plt,,)
@@ -85,6 +84,7 @@ SECTIONS
8584
{
8685
. = ALIGN(8);
8786
_image_ram_start = .;
87+
__data_region_start = .;
8888
__data_start = .;
8989

9090
*(.data)

soc/riscv/openisa_rv32m1/linker.ld

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,12 +159,11 @@ SECTIONS
159159

160160
GROUP_START(RAM)
161161

162-
__data_region_start = .;
163-
164162
SECTION_DATA_PROLOGUE(_DATA_SECTION_NAME,,)
165163
{
166164
. = ALIGN(4);
167165
_image_ram_start = .;
166+
__data_region_start = .;
168167
__data_start = .;
169168

170169
*(.data)

0 commit comments

Comments
 (0)