@@ -419,8 +419,18 @@ static void checkOptions(Ctx &ctx) {
419419 << " --pcrel-optimize is only supported on PowerPC64 targets" ;
420420 }
421421
422- if (ctx.arg .relaxGP && ctx.arg .emachine != EM_RISCV)
423- ErrAlways (ctx) << " --relax-gp is only supported on RISC-V targets" ;
422+ if (ctx.arg .emachine != EM_RISCV) {
423+ if (ctx.arg .relaxGP )
424+ ErrAlways (ctx) << " --relax-gp is only supported on RISC-V targets" ;
425+ if (ctx.arg .zZicfilpUnlabeledReport != ReportPolicy::None)
426+ ErrAlways (ctx) << " -z zicfilip-unlabeled-report is only supported on "
427+ " RISC-V targets" ;
428+ if (ctx.arg .zZicfilpFuncSigReport != ReportPolicy::None)
429+ ErrAlways (ctx) << " -z zicfilip-func-sig-report is only supported on "
430+ " RISC-V targets" ;
431+ if (ctx.arg .zZicfissReport != ReportPolicy::None)
432+ ErrAlways (ctx) << " -z zicfiss-report is only supported on RISC-V targets" ;
433+ }
424434
425435 if (ctx.arg .emachine != EM_386 && ctx.arg .emachine != EM_X86_64 &&
426436 ctx.arg .zCetReport != ReportPolicy::None)
@@ -1648,7 +1658,11 @@ static void readConfigs(Ctx &ctx, opt::InputArgList &args) {
16481658 std::make_pair (" execute-only-report" , &ctx.arg .zExecuteOnlyReport ),
16491659 std::make_pair (" gcs-report" , &ctx.arg .zGcsReport ),
16501660 std::make_pair (" gcs-report-dynamic" , &ctx.arg .zGcsReportDynamic ),
1651- std::make_pair (" pauth-report" , &ctx.arg .zPauthReport )};
1661+ std::make_pair (" pauth-report" , &ctx.arg .zPauthReport ),
1662+ std::make_pair (" zicfilp-unlabeled-report" ,
1663+ &ctx.arg .zZicfilpUnlabeledReport ),
1664+ std::make_pair (" zicfilp-func-sig-report" , &ctx.arg .zZicfilpFuncSigReport ),
1665+ std::make_pair (" zicfiss-report" , &ctx.arg .zZicfissReport )};
16521666 bool hasGcsReportDynamic = false ;
16531667 for (opt::Arg *arg : args.filtered (OPT_z)) {
16541668 std::pair<StringRef, StringRef> option =
@@ -2842,9 +2856,12 @@ static void redirectSymbols(Ctx &ctx, ArrayRef<WrappedSymbol> wrapped) {
28422856// For AArch64 PAuth-enabled object files, the core info of all of them must
28432857// match. Missing info for some object files with matching info for remaining
28442858// ones can be allowed (see -z pauth-report).
2859+ //
2860+ // RISC-V Zicfilp/Zicfiss extension also use the same mechanism to record
2861+ // enabled features in the GNU_PROPERTY_RISCV_FEATURE_1_AND bit mask.
28452862static void readSecurityNotes (Ctx &ctx) {
28462863 if (ctx.arg .emachine != EM_386 && ctx.arg .emachine != EM_X86_64 &&
2847- ctx.arg .emachine != EM_AARCH64)
2864+ ctx.arg .emachine != EM_AARCH64 && ctx. arg . emachine != EM_RISCV )
28482865 return ;
28492866
28502867 ctx.arg .andFeatures = -1 ;
@@ -2896,6 +2913,33 @@ static void readSecurityNotes(Ctx &ctx) {
28962913 << " : -z cet-report: file does not have "
28972914 " GNU_PROPERTY_X86_FEATURE_1_SHSTK property" ;
28982915
2916+ if (ctx.arg .emachine == EM_RISCV) {
2917+ reportUnless (ctx.arg .zZicfilpUnlabeledReport ,
2918+ features & GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED)
2919+ << f
2920+ << " : -z zicfilp-unlabeled-report: file does not have "
2921+ " GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED property" ;
2922+
2923+ reportUnless (ctx.arg .zZicfilpFuncSigReport ,
2924+ features & GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG)
2925+ << f
2926+ << " : -z zicfilp-func-sig-report: file does not have "
2927+ " GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG property" ;
2928+
2929+ if ((features & GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED) &&
2930+ (features & GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG))
2931+ Err (ctx) << f
2932+ << " : file has conflicting properties: "
2933+ " GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_UNLABELED and "
2934+ " GNU_PROPERTY_RISCV_FEATURE_1_CFI_LP_FUNC_SIG" ;
2935+
2936+ reportUnless (ctx.arg .zZicfissReport ,
2937+ features & GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS)
2938+ << f
2939+ << " : -z zicfiss-report: file does not have "
2940+ " GNU_PROPERTY_RISCV_FEATURE_1_CFI_SS property" ;
2941+ }
2942+
28992943 if (ctx.arg .zForceBti && !(features & GNU_PROPERTY_AARCH64_FEATURE_1_BTI)) {
29002944 features |= GNU_PROPERTY_AARCH64_FEATURE_1_BTI;
29012945 if (ctx.arg .zBtiReport == ReportPolicy::None)
0 commit comments