Skip to content

Commit

Permalink
llext: remove LIB_MANAGER_BSS
Browse files Browse the repository at this point in the history
We don't need to store .bss address and size until the module is
freed since .bss is allocated together with .data and we only need
its size when initialising it, not when freeing module memory. Remove
it to save memory.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
  • Loading branch information
lyakh committed Dec 3, 2024
1 parent 5cbea2b commit 1caf36c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/include/sof/lib_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ enum {
LIB_MANAGER_TEXT,
LIB_MANAGER_DATA,
LIB_MANAGER_RODATA,
LIB_MANAGER_BSS,
LIB_MANAGER_N_SEGMENTS,
};

Expand Down
11 changes: 2 additions & 9 deletions src/library_manager/llext_manager.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,8 @@ static int llext_manager_load_module(const struct llext *ext, const struct llext

/* .bss, should be within writable data above */
void __sparse_cache *bss_addr = (void __sparse_cache *)
ctx->segment[LIB_MANAGER_BSS].addr;
size_t bss_size = ctx->segment[LIB_MANAGER_BSS].size;
ebl->loader.sects[LLEXT_MEM_BSS].sh_addr;
size_t bss_size = ebl->loader.sects[LLEXT_MEM_BSS].sh_size;
int ret;

/* Check, that .bss is within .data */
Expand Down Expand Up @@ -282,13 +282,6 @@ static int llext_manager_link(struct llext_buf_loader *ebl, uintptr_t dram_base,
ctx->segment[LIB_MANAGER_DATA].addr,
ctx->segment[LIB_MANAGER_DATA].size);

ctx->segment[LIB_MANAGER_BSS].addr = ebl->loader.sects[LLEXT_MEM_BSS].sh_addr;
ctx->segment[LIB_MANAGER_BSS].size = ebl->loader.sects[LLEXT_MEM_BSS].sh_size;

tr_dbg(&lib_manager_tr, ".bss: start: %#lx size %#x",
ctx->segment[LIB_MANAGER_BSS].addr,
ctx->segment[LIB_MANAGER_BSS].size);

ssize_t binfo_o = llext_find_section(&ebl->loader, ".mod_buildinfo");

if (binfo_o >= 0)
Expand Down

0 comments on commit 1caf36c

Please sign in to comment.