Elf2Mac: don't insist that sections actually exist

This commit is contained in:
Wolfgang Thaller 2022-12-04 10:28:33 +01:00
parent b7f956111a
commit a966fd5f8a
2 changed files with 4 additions and 3 deletions

View File

@ -97,8 +97,8 @@ Object::Object(string input)
if(boost::algorithm::starts_with(name,".rela.")) if(boost::algorithm::starts_with(name,".rela."))
{ {
string progbitsName = name.substr(5); string progbitsName = name.substr(5);
assert(sections.find(progbitsName) != sections.end()); if(sections.find(progbitsName) != sections.end())
sections[progbitsName]->SetRela(scn); sections[progbitsName]->SetRela(scn);
} }
} }
if(shdr.sh_type == SHT_PROGBITS && (shdr.sh_flags & SHF_ALLOC)) if(shdr.sh_type == SHT_PROGBITS && (shdr.sh_flags & SHF_ALLOC))

View File

@ -36,7 +36,8 @@ Symbol::Symbol(Object& theObject, const GElf_Sym &sym)
if(st_shndx != SHN_UNDEF && st_shndx < SHN_LORESERVE) if(st_shndx != SHN_UNDEF && st_shndx < SHN_LORESERVE)
{ {
section = theObject.sectionsByElfIndex[st_shndx]; section = theObject.sectionsByElfIndex[st_shndx];
sectionKind = section->kind; if (section)
sectionKind = section->kind;
} }
if(st_name) if(st_name)
{ {