Skip to content

Commit 50ab695

Browse files
pillo79mmahadevan108
authored andcommitted
linker: llext: avoid modifying current address in linker script snippet
The linker script snippet that places the llext_no_syscall_impl section has the unfortunate side effect of overwriting the current linker address. This can lead to unexpected behavior of the caller script. Saving the current address before defining the section and restoring it afterwards avoids this issue. Fixes #81136. Signed-off-by: Luca Burelli <[email protected]>
1 parent ebac6f2 commit 50ab695

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

include/zephyr/linker/llext-sections.ld

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
/* SPDX-License-Identifier: Apache-2.0 */
22

33
/*
4-
* Map the no_syscall_impl symbol in llext_export_syscalls.c to
4+
* Save the current address to avoid changing it in this file.
5+
*/
6+
HIDDEN(__llext_current_addr = .);
7+
8+
/*
9+
* Map the 'no_syscall_impl' symbol in 'syscall_export_llext.c' to
510
* absolute address 0 so other weak symbols are exported as NULL.
611
* This section is used for mapping that symbol only and is not
712
* to be included in the final binary.
813
*/
9-
1014
SECTION_PROLOGUE(llext_no_syscall_impl, 0 (COPY), )
1115
{
1216
*(llext_no_syscall_impl)
@@ -29,3 +33,5 @@
2933
KEEP(*(llext_exports_strtab))
3034
}
3135
#endif
36+
37+
. = __llext_current_addr;

0 commit comments

Comments
 (0)