Avoid UB deref of nullptr to reference. NFC.

Its possible for file to have no entry atom which means that there
is no atom to check for being a thumb function.  Instead just skip
the thumb check and set the entry address to 0, which matches the
current behaviour of getting a default initialised int from a map.

llvm-svn: 264233
This commit is contained in:
Pete Cooper 2016-03-24 01:14:10 +00:00
parent 07601d33f8
commit 07134ae364
1 changed files with 5 additions and 0 deletions

View File

@ -715,6 +715,11 @@ void Util::updateSectionInfo(NormalizedFile &file) {
}
void Util::copyEntryPointAddress(NormalizedFile &nFile) {
if (!_entryAtom) {
nFile.entryAddress = 0;
return;
}
if (_ctx.outputTypeHasEntry()) {
if (_archHandler.isThumbFunction(*_entryAtom))
nFile.entryAddress = (_atomToAddress[_entryAtom] | 1);