@@ -65,6 +65,8 @@ extern cl::opt<bool> StrictMode;
65
65
extern cl::opt<bool > UpdateDebugSections;
66
66
extern cl::opt<unsigned > Verbosity;
67
67
68
+ extern bool BinaryAnalysisMode;
69
+ extern bool HeatmapMode;
68
70
extern bool processAllFunctions ();
69
71
70
72
static cl::opt<bool > CheckEncoding (
@@ -2760,13 +2762,19 @@ struct CFISnapshot {
2760
2762
}
2761
2763
case MCCFIInstruction::OpAdjustCfaOffset:
2762
2764
case MCCFIInstruction::OpWindowSave:
2763
- case MCCFIInstruction::OpNegateRAState:
2764
2765
case MCCFIInstruction::OpNegateRAStateWithPC:
2765
2766
case MCCFIInstruction::OpLLVMDefAspaceCfa:
2766
2767
case MCCFIInstruction::OpLabel:
2767
2768
case MCCFIInstruction::OpValOffset:
2768
2769
llvm_unreachable (" unsupported CFI opcode" );
2769
2770
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 ;
2770
2778
case MCCFIInstruction::OpRememberState:
2771
2779
case MCCFIInstruction::OpRestoreState:
2772
2780
case MCCFIInstruction::OpGnuArgsSize:
@@ -2900,13 +2908,19 @@ struct CFISnapshotDiff : public CFISnapshot {
2900
2908
return CFAReg == Instr.getRegister () && CFAOffset == Instr.getOffset ();
2901
2909
case MCCFIInstruction::OpAdjustCfaOffset:
2902
2910
case MCCFIInstruction::OpWindowSave:
2903
- case MCCFIInstruction::OpNegateRAState:
2904
2911
case MCCFIInstruction::OpNegateRAStateWithPC:
2905
2912
case MCCFIInstruction::OpLLVMDefAspaceCfa:
2906
2913
case MCCFIInstruction::OpLabel:
2907
2914
case MCCFIInstruction::OpValOffset:
2908
2915
llvm_unreachable (" unsupported CFI opcode" );
2909
2916
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 ;
2910
2924
case MCCFIInstruction::OpRememberState:
2911
2925
case MCCFIInstruction::OpRestoreState:
2912
2926
case MCCFIInstruction::OpGnuArgsSize:
@@ -3051,13 +3065,19 @@ BinaryFunction::unwindCFIState(int32_t FromState, int32_t ToState,
3051
3065
break ;
3052
3066
case MCCFIInstruction::OpAdjustCfaOffset:
3053
3067
case MCCFIInstruction::OpWindowSave:
3054
- case MCCFIInstruction::OpNegateRAState:
3055
3068
case MCCFIInstruction::OpNegateRAStateWithPC:
3056
3069
case MCCFIInstruction::OpLLVMDefAspaceCfa:
3057
3070
case MCCFIInstruction::OpLabel:
3058
3071
case MCCFIInstruction::OpValOffset:
3059
3072
llvm_unreachable (" unsupported CFI opcode" );
3060
3073
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 ;
3061
3081
case MCCFIInstruction::OpGnuArgsSize:
3062
3082
// do not affect CFI state
3063
3083
break ;
0 commit comments