llext: add support for global functions
Loadable modules can contain global (not "static") functions, even if they aren't exported for use by other modules, e.g. when a module is built from multiple .c files. Such functions are then also included in link tables and have to be re-linked. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
parent
e5c8d181d4
commit
0b5bfd22e3
1 changed files with 3 additions and 1 deletions
|
@ -530,7 +530,7 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext,
|
||||||
uint32_t stt = ELF_ST_TYPE(sym_tbl.st_info);
|
uint32_t stt = ELF_ST_TYPE(sym_tbl.st_info);
|
||||||
uint32_t stb = ELF_ST_BIND(sym_tbl.st_info);
|
uint32_t stb = ELF_ST_BIND(sym_tbl.st_info);
|
||||||
|
|
||||||
if (stt != STT_NOTYPE || sym_tbl.st_shndx != SHN_UNDEF) {
|
if (stt != STT_FUNC && (stt != STT_NOTYPE || sym_tbl.st_shndx != SHN_UNDEF)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -547,6 +547,8 @@ static void llext_link_plt(struct llext_loader *ldr, struct llext *ext,
|
||||||
switch (stb) {
|
switch (stb) {
|
||||||
case STB_GLOBAL:
|
case STB_GLOBAL:
|
||||||
link_addr = llext_find_sym(NULL, name);
|
link_addr = llext_find_sym(NULL, name);
|
||||||
|
if (!link_addr)
|
||||||
|
link_addr = llext_find_sym(&ext->sym_tab, name);
|
||||||
|
|
||||||
if (!link_addr) {
|
if (!link_addr) {
|
||||||
LOG_WRN("PLT: cannot find idx %u name %s", j, name);
|
LOG_WRN("PLT: cannot find idx %u name %s", j, name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue