Skip to content

Commit ff55f69

Browse files
committed
variants/_ldscripts: Fix static thread data alignment.
The _static_thread_data struct contains int64_t members that require 8-byte alignment. When placed in a 4-byte aligned section, it causes the linker to insert padding, which in turn causes __static_thread_data_list_start to point to the padding not to the first iterable. Signed-off-by: iabdalkader <[email protected]>
1 parent 335f835 commit ff55f69

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

variants/_ldscripts/build-dynamic.ld

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,9 @@ SECTIONS {
3434
KEEP (*(.ctors))
3535
KEEP (*(.dtors))
3636
KEEP (*(.fini))
37+
}
3738

39+
.static_thread_data_area : ALIGN(8) {
3840
__static_thread_data_list_start = .;
3941
KEEP(*(SORT_BY_NAME(.__static_thread_data.static.*)));
4042
__static_thread_data_list_end = .;
@@ -87,4 +89,4 @@ SECTIONS {
8789
.got : {
8890
KEEP(*(.got .got.* .got.plt .got.plt*))
8991
}
90-
}
92+
}

variants/_ldscripts/build-static.ld

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@ SECTIONS {
2323
KEEP (*(.ctors))
2424
KEEP (*(.dtors))
2525
KEEP (*(.fini))
26+
} >FLASH
2627

28+
.static_thread_data_area : ALIGN(8) {
2729
__static_thread_data_list_start = .;
2830
KEEP(*(SORT_BY_NAME(.__static_thread_data.static.*)));
2931
__static_thread_data_list_end = .;

0 commit comments

Comments
 (0)