Have elf_lookup() return an error if the specified non-weak symbol could

not be found. Otherwise, relocations against such symbols will be silently
ignored instead of causing an error to be raised.

Reviewed by:	kib
MFC after:	1 week
This commit is contained in:
Mark Johnston 2015-11-03 03:29:35 +00:00
parent 5f4d46e2ac
commit e8e0fac552
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=290320

View File

@ -1594,6 +1594,10 @@ elf_lookup(linker_file_t lf, Elf_Size symidx, int deps, Elf_Addr *res)
}
addr = ((Elf_Addr)linker_file_lookup_symbol(lf, symbol, deps));
if (addr == 0 && ELF_ST_BIND(sym->st_info) != STB_WEAK) {
*res = 0;
return (EINVAL);
}
if (elf_set_find(&set_pcpu_list, addr, &start, &base))
addr = addr - start + base;