forked from OSchip/llvm-project
Fix LSDA reading issues.
Summary: There were two issues: we were trying to process non-simple functions, i.e. function that we don't fully understand, and then we failed to stop iterating if EH closing label was after the last instruction in a function. (cherry picked from FBD2664460)
This commit is contained in:
parent
be2a19523c
commit
56cca2fb5b
|
@ -340,8 +340,8 @@ void BinaryFunction::parseLSDA(ArrayRef<uint8_t> LSDASectionData,
|
|||
|
||||
// Mark all call instructions in the range.
|
||||
auto II = Instructions.find(Start);
|
||||
assert(II != Instructions.end() &&
|
||||
"exception range not pointing to instruction");
|
||||
auto IE = Instructions.end();
|
||||
assert(II != IE && "exception range not pointing to an instruction");
|
||||
do {
|
||||
auto &Instruction = II->second;
|
||||
if (BC.MIA->isCall(Instruction)) {
|
||||
|
@ -356,7 +356,7 @@ void BinaryFunction::parseLSDA(ArrayRef<uint8_t> LSDASectionData,
|
|||
Instruction.addOperand(MCOperand::createImm(ActionEntry));
|
||||
}
|
||||
++II;
|
||||
} while (II->first < Start + Length);
|
||||
} while (II != IE && II->first < Start + Length);
|
||||
|
||||
if (ActionEntry != 0) {
|
||||
auto printType = [&] (int Index, raw_ostream &OS) {
|
||||
|
|
|
@ -544,7 +544,7 @@ static void OptimizeFile(ELFObjectFileBase *File, const DataReader &DR) {
|
|||
(SectionContents.data()) + FunctionOffset,
|
||||
Function.getSize());
|
||||
|
||||
if (!Function.disassemble(FunctionData))
|
||||
if (!Function.disassemble(FunctionData) || !Function.isSimple())
|
||||
continue;
|
||||
|
||||
// Fill in CFI information for this function
|
||||
|
|
Loading…
Reference in New Issue