summaryrefslogtreecommitdiffstats
path: root/sys/kern/link_elf.c
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2002-10-15 05:40:07 +0000
committermarcel <marcel@FreeBSD.org>2002-10-15 05:40:07 +0000
commite92a3178463f8ffde179f9d77416f32fb7b6aea7 (patch)
tree62b0f9ee69593eec2bec443afbb561961105257f /sys/kern/link_elf.c
parent5080f0df6b88d0e04a6189469de8e98a34d8ad1a (diff)
downloadFreeBSD-src-e92a3178463f8ffde179f9d77416f32fb7b6aea7.zip
FreeBSD-src-e92a3178463f8ffde179f9d77416f32fb7b6aea7.tar.gz
Fix kernel module loading on ia64. Cross-module function calls
were improperly relocated due to faulty logic in lookup_fdesc() in elf_machdep.c. The symbol index (symidx) was bogusly used for load modules other than the one the relocation applied to. This resulted in bogus bindings and consequently runtime failures. The fix is to use the symbol index only for the module being relocated and to use the symbol name for look-ups in the modules in the dependent list. As such, we need a function to return the symbol name given the linker file and symbol index.
Diffstat (limited to 'sys/kern/link_elf.c')
-rw-r--r--sys/kern/link_elf.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index 83fbe17..a2ba84e 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -1198,6 +1198,18 @@ elf_get_sym(linker_file_t lf, Elf_Word symidx)
return (ef->symtab + symidx);
}
+const char *
+elf_get_symname(linker_file_t lf, Elf_Word symidx)
+{
+ elf_file_t ef = (elf_file_t)lf;
+ const Elf_Sym *sym;
+
+ if (symidx >= ef->nchains)
+ return (NULL);
+ sym = ef->symtab + symidx;
+ return (ef->strtab + sym->st_name);
+}
+
/*
* Symbol lookup function that can be used when the symbol index is known (ie
* in relocations). It uses the symbol index instead of doing a fully fledged
OpenPOWER on IntegriCloud