@@ -65,6 +65,8 @@ extern cl::opt<bool> StrictMode;
6565extern cl::opt<bool > UpdateDebugSections;
6666extern cl::opt<unsigned > Verbosity;
6767
68+ extern bool BinaryAnalysisMode;
69+ extern bool HeatmapMode;
6870extern bool processAllFunctions ();
6971
7072static cl::opt<bool > CheckEncoding (
@@ -2760,13 +2762,19 @@ struct CFISnapshot {
27602762 }
27612763 case MCCFIInstruction::OpAdjustCfaOffset:
27622764 case MCCFIInstruction::OpWindowSave:
2763- case MCCFIInstruction::OpNegateRAState:
27642765 case MCCFIInstruction::OpNegateRAStateWithPC:
27652766 case MCCFIInstruction::OpLLVMDefAspaceCfa:
27662767 case MCCFIInstruction::OpLabel:
27672768 case MCCFIInstruction::OpValOffset:
27682769 llvm_unreachable (" unsupported CFI opcode" );
27692770 break ;
2771+ case MCCFIInstruction::OpNegateRAState:
2772+ if (!(opts::BinaryAnalysisMode || opts::HeatmapMode)) {
2773+ llvm_unreachable (" BOLT-ERROR: binaries using pac-ret hardening (e.g. "
2774+ " as produced by '-mbranch-protection=pac-ret') are "
2775+ " currently not supported by BOLT." );
2776+ }
2777+ break ;
27702778 case MCCFIInstruction::OpRememberState:
27712779 case MCCFIInstruction::OpRestoreState:
27722780 case MCCFIInstruction::OpGnuArgsSize:
@@ -2900,13 +2908,19 @@ struct CFISnapshotDiff : public CFISnapshot {
29002908 return CFAReg == Instr.getRegister () && CFAOffset == Instr.getOffset ();
29012909 case MCCFIInstruction::OpAdjustCfaOffset:
29022910 case MCCFIInstruction::OpWindowSave:
2903- case MCCFIInstruction::OpNegateRAState:
29042911 case MCCFIInstruction::OpNegateRAStateWithPC:
29052912 case MCCFIInstruction::OpLLVMDefAspaceCfa:
29062913 case MCCFIInstruction::OpLabel:
29072914 case MCCFIInstruction::OpValOffset:
29082915 llvm_unreachable (" unsupported CFI opcode" );
29092916 return false ;
2917+ case MCCFIInstruction::OpNegateRAState:
2918+ if (!(opts::BinaryAnalysisMode || opts::HeatmapMode)) {
2919+ llvm_unreachable (" BOLT-ERROR: binaries using pac-ret hardening (e.g. "
2920+ " as produced by '-mbranch-protection=pac-ret') are "
2921+ " currently not supported by BOLT." );
2922+ }
2923+ break ;
29102924 case MCCFIInstruction::OpRememberState:
29112925 case MCCFIInstruction::OpRestoreState:
29122926 case MCCFIInstruction::OpGnuArgsSize:
@@ -3051,13 +3065,19 @@ BinaryFunction::unwindCFIState(int32_t FromState, int32_t ToState,
30513065 break ;
30523066 case MCCFIInstruction::OpAdjustCfaOffset:
30533067 case MCCFIInstruction::OpWindowSave:
3054- case MCCFIInstruction::OpNegateRAState:
30553068 case MCCFIInstruction::OpNegateRAStateWithPC:
30563069 case MCCFIInstruction::OpLLVMDefAspaceCfa:
30573070 case MCCFIInstruction::OpLabel:
30583071 case MCCFIInstruction::OpValOffset:
30593072 llvm_unreachable (" unsupported CFI opcode" );
30603073 break ;
3074+ case MCCFIInstruction::OpNegateRAState:
3075+ if (!(opts::BinaryAnalysisMode || opts::HeatmapMode)) {
3076+ llvm_unreachable (" BOLT-ERROR: binaries using pac-ret hardening (e.g. "
3077+ " as produced by '-mbranch-protection=pac-ret') are "
3078+ " currently not supported by BOLT." );
3079+ }
3080+ break ;
30613081 case MCCFIInstruction::OpGnuArgsSize:
30623082 // do not affect CFI state
30633083 break ;
0 commit comments