don't include relocs for undefined symbols - they should stay at absolute NULL

This commit is contained in:
Wolfgang Thaller 2017-09-24 00:29:50 +02:00
parent 975c1f31c3
commit 6c1e76280e
1 changed files with 7 additions and 0 deletions

View File

@ -101,6 +101,13 @@ void ElfToFlt(string input, string output)
GElf_Rela rela;
gelf_getrela(data, i, &rela);
GElf_Sym sym;
if(gelf_getsym(symtabData, GELF_R_SYM(rela.r_info),&sym) != 0)
{
if(sym.st_shndx == SHN_UNDEF)
continue;
}
if(GELF_R_TYPE(rela.r_info) == R_68K_32)
relocs.push_back(rela.r_offset);
//printf("rel: %d %d %x %x\n", (int)GELF_R_TYPE(rela.r_info), (int)GELF_R_SYM(rela.r_info), (unsigned)rela.r_addend, (unsigned)rela.r_offset);