File tree Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Expand file tree Collapse file tree 3 files changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -201,7 +201,11 @@ int32_t BinaryBasicBlock::getCFIStateAtInstr(const MCInst *Instr) const {
201201 InstrSeen = (&Inst == Instr);
202202 continue ;
203203 }
204- if (Function->getBinaryContext ().MIB ->isCFI (Inst)) {
204+ // Fix: ignoring OpNegateRAState CFIs here, as they dont have a "State"
205+ // number associated with them.
206+ if (Function->getBinaryContext ().MIB ->isCFI (Inst) &&
207+ (Function->getCFIFor (Inst)->getOperation () !=
208+ MCCFIInstruction::OpNegateRAState)) {
205209 LastCFI = &Inst;
206210 break ;
207211 }
Original file line number Diff line number Diff line change @@ -2596,6 +2596,7 @@ struct CFISnapshot {
25962596 void advanceTo (int32_t State) {
25972597 for (int32_t I = CurState, E = State; I != E; ++I) {
25982598 const MCCFIInstruction &Instr = FDE[I];
2599+ assert (Instr.getOperation () != MCCFIInstruction::OpNegateRAState);
25992600 if (Instr.getOperation () != MCCFIInstruction::OpRestoreState) {
26002601 update (Instr, I);
26012602 continue ;
Original file line number Diff line number Diff line change @@ -632,8 +632,10 @@ bool CFIReaderWriter::fillCFIInfoFor(BinaryFunction &Function) const {
632632 // DW_CFA_GNU_window_save and DW_CFA_GNU_NegateRAState just use the same
633633 // id but mean different things. The latter is used in AArch64.
634634 if (Function.getBinaryContext ().isAArch64 ()) {
635- Function.addCFIInstruction (
636- Offset, MCCFIInstruction::createNegateRAState (nullptr ));
635+ // Fix: not adding OpNegateRAState since the location they are needed
636+ // depends on the order of BasicBlocks, which changes during
637+ // optimizations. They are generated in InsertNegateRAStatePass after
638+ // optimizations instead.
637639 break ;
638640 }
639641 if (opts::Verbosity >= 1 )
You can’t perform that action at this time.
0 commit comments