[clang] [llvm] [RISC-V] Disable save-restore with shadow stack (PR #225610)

Nemanja Ivanovic via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 5 01:23:41 PDT 2026


================
@@ -213,6 +214,19 @@ void riscv::getRISCVTargetFeatures(const Driver &D, const llvm::Triple &Triple,
   for (const std::string &TF : TuneFeatures)
     Features.push_back(Args.MakeArgString(TF));
 
+  if (Args.getLastArg(options::OPT_msave_restore)) {
+    auto FCFArgVal = Args.getLastArgValue(options::OPT_fcf_protection_EQ);
+    if (Args.hasArg(options::OPT_fcf_protection) || FCFArgVal == "return" ||
+        FCFArgVal == "full")
----------------
nemanjai wrote:

Doesn't `Args.getLastArg(options::OPT_msave_restore)` only return `true` if the last (winning) argument is `-msave-restore`?

https://github.com/llvm/llvm-project/pull/225610


More information about the cfe-commits mailing list