fix symtab map bad offset

This commit is contained in:
Freya Murphy 2024-09-23 10:25:01 -04:00
parent 9a3ccc2fc1
commit f918f8fe1c
Signed by: freya
GPG key ID: 744AB800E383AE52
3 changed files with 3 additions and 2 deletions

View file

@ -55,12 +55,13 @@ int symtab_get(struct symbol_table *symtab, Elf32_Sym **res, const char *name,
const char *symname = symtab->strtab->data + B32(sym->st_name); const char *symname = symtab->strtab->data + B32(sym->st_name);
if (strcmp(name, symname) != 0) if (strcmp(name, symname) != 0)
continue; continue;
// only allow retrevial of local variables from the // only allow retrevial of local variables from the
// same object // same object
if (sym->st_info >> 4 != STB_GLOBAL && symtab->map != NULL && if (sym->st_info >> 4 != STB_GLOBAL && symtab->map != NULL &&
obj_idx >= 0) { obj_idx >= 0) {
struct object *obj = symtab->map->meta[i]; // we need to change the index by one since
// symbol tables always start will a NULl symbol
struct object *obj = symtab->map->meta[i - 1];
if (obj->index != (uint32_t)obj_idx) if (obj->index != (uint32_t)obj_idx)
continue; continue;
} else if (obj_idx < 0 && sym->st_info >> 4 != STB_GLOBAL) { } else if (obj_idx < 0 && sym->st_info >> 4 != STB_GLOBAL) {

BIN
mld/vgcore.4024670 Normal file

Binary file not shown.

Binary file not shown.