From 1cab0c857e3cc81ea3148f393932aa702eb9aa75 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Tue, 15 Jun 2004 01:35:57 +0000 Subject: [PATCH] Fix symbol lookups between modules. This caused modules that depend on other modules to explode. eg: snd_ich->snd_pcm and umass->usb. The problem was that I was using the unified base address of the module instead of finding the start address of the section in question. --- sys/kern/link_elf_obj.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c index 0c6c4f9ff0cb..41417cd5b7c3 100644 --- a/sys/kern/link_elf_obj.c +++ b/sys/kern/link_elf_obj.c @@ -747,12 +747,16 @@ static int link_elf_symbol_values(linker_file_t lf, c_linker_sym_t sym, linker_symval_t *symval) { + Elf_Addr base; elf_file_t ef = (elf_file_t) lf; const Elf_Sym *es = (const Elf_Sym*) sym; if (es >= ef->ddbsymtab && es < (ef->ddbsymtab + ef->ddbsymcnt)) { + base = findbase(ef, es->st_shndx); + if (base == 0) + base = (Elf_Addr)ef->address; symval->name = ef->ddbstrtab + es->st_name; - symval->value = (caddr_t) ef->address + es->st_value; + symval->value = (caddr_t)base + es->st_value; symval->size = es->st_size; return 0; }