Skip to content

llext: Split linking and loading #93274

@teburd

Description

@teburd

Summary

LLEXT in its llext_load function helpfully sets up memory, copies sections, and links (applies relocations) for the ELF assuming the memory it setup is where the extension will be. There's some loader options that make it do slightly different things with branching internally but this I think makes the code more complex than it needs to be.

It can be useful to store the extension in one location (flash or slower ram) but link it as if it were placed in a different location (sram/tcm). This is what SOF does, and its what XIP/flash stored extensions would also want to do.

Not all sections need to work this way... its unlikely .rodata would be moved, but .text might be, and .data/.bss almost certainly have to be in the XIP from flash scenario.

Describe the solution you'd like

A way to link and copy an extension to a storage location (flash, slow ram, etc) while linking it for a different location where some sections will be copied/allocated to in the future (sram/tcm).

Another function to load it into the different location (sram) with either real or virtualized addressing when an MMU exists.

All mpu/mmu region setup, icache/dcache invalidation would happen at load time, not copy and link time.

Alternatives

Continue leaving SOF to work around this, not having XIP support for others in Zephyr

Additional Context

No response

Metadata

Metadata

Assignees

Labels

EnhancementChanges/Updates/Additions to existing featuresarea: llextLinkable Loadable Extensions

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions