@@ -1044,8 +1044,10 @@ MCSymbol *BinaryFunction::getOrCreateLocalLabel(uint64_t Address) {
10441044
10451045 // For AArch64, check if this address is part of a constant island.
10461046 if (BC.isAArch64 ()) {
1047- if (MCSymbol *IslandSym = getOrCreateIslandAccess (Address))
1047+ if (MCSymbol *IslandSym = getOrCreateIslandAccess (Address)) {
1048+ Labels[Offset] = IslandSym;
10481049 return IslandSym;
1050+ }
10491051 }
10501052
10511053 if (Offset == getSize ())
@@ -1925,7 +1927,8 @@ bool BinaryFunction::validateExternalBranch(uint64_t TargetAddress) {
19251927 return true ;
19261928
19271929 if (TargetFunction->CurrentState == State::Disassembled &&
1928- !TargetFunction->getInstructionAtOffset (TargetOffset))
1930+ (!TargetFunction->getInstructionAtOffset (TargetOffset) ||
1931+ getSizeOfDataInCodeAt (TargetOffset)))
19291932 IsValid = false ;
19301933 } else {
19311934 if (!BC.getSectionForAddress (TargetAddress))
@@ -1959,15 +1962,14 @@ bool BinaryFunction::validateInternalBranch() {
19591962 if (!Offset || (Offset > getSize ()))
19601963 continue ;
19611964
1962- if (getInstructionAtOffset (Offset))
1963- continue ;
1964-
1965- BC.errs () << " BOLT-WARNING: corrupted control flow detected in function "
1966- << *this << " , an internal branch/call targets an invalid "
1967- << " instruction at address 0x"
1968- << Twine::utohexstr (getAddress () + Offset) << " \n " ;
1969- setIgnored ();
1970- return false ;
1965+ if (!getInstructionAtOffset (Offset) || getSizeOfDataInCodeAt (Offset)) {
1966+ BC.errs () << " BOLT-WARNING: corrupted control flow detected in function "
1967+ << *this << " , an internal branch/call targets an invalid "
1968+ << " instruction at address 0x"
1969+ << Twine::utohexstr (getAddress () + Offset) << " \n " ;
1970+ setIgnored ();
1971+ return false ;
1972+ }
19711973 }
19721974
19731975 return true ;
0 commit comments