Skip to content

WIP: fully relocatable llext modules in virtual memory - #11037

Draft
lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:topic/llext-relocatable
Draft

WIP: fully relocatable llext modules in virtual memory#11037
lgirdwood wants to merge 3 commits into
thesofproject:mainfrom
lgirdwood:topic/llext-relocatable

Conversation

@lgirdwood

Copy link
Copy Markdown
Member

Fully relocatable modules, they - TODO need to reuse virtual memory block allocator.

lrgirdwo added 3 commits July 24, 2026 16:22
When CONFIG_LLEXT_TYPE_ELF_RELOCATABLE is active, bypass appending
static address flags (-Ttext, --section-start, -Tdata) in the linker
helper script. This keeps section base addresses at 0.
Also adjust the offset calculator to avoid integer parsing errors
when all section addresses are set to 0.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
…table modules

Implement page-level virtual memory mapping using Zephyr's sys_bitarray
utility over the library region. Compile section layout at load-time to
allocate virtual addresses and rewrite section sh_addr headers in-place.
This enables Zephyr LLEXT to naturally relocate references.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Enable CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y in llext_relocatable.conf
to link relocatable LLEXT modules against build-time function signature
hashing, providing load-time ABI mismatch protection.

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to use single virtual page source for all virtual page allocations.

#include <zephyr/llext/elf.h>

#define LLEXT_LIB_PAGES (CONFIG_LIBRARY_REGION_SIZE / PAGE_SZ)
SYS_BITARRAY_DEFINE_STATIC(lib_vma_bitarray, LLEXT_LIB_PAGES);

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see zephyr/lib/alloc.c and the zephyr TLB driver for ACE platforms, we want to have a single VMA allocation i.e. teh one used by vpage allocator should be used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants