Skip to content
Draft
1 change: 1 addition & 0 deletions app/llext_relocatable.conf
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
CONFIG_LLEXT_TYPE_ELF_RELOCATABLE=y
CONFIG_LLEXT_EXPORT_BUILTINS_BY_SLID=y
23 changes: 15 additions & 8 deletions scripts/llext_link_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ def main():

command = [args.command]

is_relocatable = '-r' in args.params

executable = []
writable = []
readonly = []
Expand Down Expand Up @@ -111,7 +113,8 @@ def main():
text_found = True
text_addr = max_alignment(text_addr, 0x1000, s_alignment)
text_size = s_size
command.append(f'-Wl,-Ttext=0x{text_addr:x}')
if not is_relocatable:
command.append(f'-Wl,-Ttext=0x{text_addr:x}')
else:
executable.append(section)

Expand Down Expand Up @@ -164,7 +167,8 @@ def main():

dram_addr = align_up(dram_addr, s_alignment)

command.append(f'-Wl,--section-start={s_name}=0x{dram_addr:x}')
if not is_relocatable:
command.append(f'-Wl,--section-start={s_name}=0x{dram_addr:x}')

dram_addr += section.header['sh_size']

Expand All @@ -177,7 +181,8 @@ def main():

dram_addr = align_up(dram_addr, s_alignment)

command.append(f'-Wl,--section-start={s_name}=0x{dram_addr:x}')
if not is_relocatable:
command.append(f'-Wl,--section-start={s_name}=0x{dram_addr:x}')

dram_addr += section.header['sh_size']

Expand All @@ -189,7 +194,8 @@ def main():

start_addr = align_up(start_addr, s_alignment)

command.append(f'-Wl,--section-start={s_name}=0x{start_addr:x}')
if not is_relocatable:
command.append(f'-Wl,--section-start={s_name}=0x{start_addr:x}')

start_addr += section.header['sh_size']

Expand All @@ -201,10 +207,11 @@ def main():

start_addr = align_up(start_addr, s_alignment)

if s_name == '.data':
command.append(f'-Wl,-Tdata=0x{start_addr:x}')
else:
command.append(f'-Wl,--section-start={s_name}=0x{start_addr:x}')
if not is_relocatable:
if s_name == '.data':
command.append(f'-Wl,-Tdata=0x{start_addr:x}')
else:
command.append(f'-Wl,--section-start={s_name}=0x{start_addr:x}')

start_addr += section.header['sh_size']

Expand Down
3 changes: 3 additions & 0 deletions scripts/llext_offset_calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ def get_elf_size(elf_name):
if section.header['sh_addr'] + section.header['sh_size'] > end:
end = section.header['sh_addr'] + section.header['sh_size']

if start == 0xffffffff:
return 0

size = end - start

return size
Expand Down
2 changes: 2 additions & 0 deletions src/include/sof/lib_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ struct lib_manager_module {
unsigned int n_dependent; /* For auxiliary modules: number of dependents */
bool mapped;
struct lib_manager_segment_desc segment[LIB_MANAGER_N_SEGMENTS];
uintptr_t vma_base;
size_t vma_size;
};

struct lib_manager_mod_ctx {
Expand Down
6 changes: 0 additions & 6 deletions src/library_manager/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,4 @@ config LIBRARY_BASE_ADDRESS
automatically but the beginning of that area is platform-specific and
should be set by this option.

config LIBRARY_REGION_SIZE
hex "Size of memory region dedicated to loadable modules"
default 0x100000
help
Size of the virtual memory region dedicated for loadable modules

endmenu
Loading