llext: fix read-only extension image
When using the LLEXT buffer loader we now avoid copying extensions from storage to allocated memory by pointing directly into the stored image. We then also perform linking and relocation in that memory, which modifies its contents. However, this is impossible if that storage is read-only. Add a Kconfig flag to distinguish between writable and read-only storage types. Also use that flag to decide, whether the extension image in test_llext_simple.c should be defined as const or not. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
4e3e9a618e
commit
dbea13a1c7
4 changed files with 14 additions and 2 deletions
|
@ -303,7 +303,8 @@ static int llext_copy_section(struct llext_loader *ldr, struct llext *ext,
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (ldr->sects[sect_idx].sh_type != SHT_NOBITS) {
|
||||
if (ldr->sects[sect_idx].sh_type != SHT_NOBITS &&
|
||||
IS_ENABLED(CONFIG_LLEXT_STORAGE_WRITABLE)) {
|
||||
ext->mem[mem_idx] = llext_peek(ldr, ldr->sects[sect_idx].sh_offset);
|
||||
if (ext->mem[mem_idx]) {
|
||||
ext->mem_on_heap[mem_idx] = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue