================
@@ -3833,8 +3836,10 @@ static void RenderSCPOptions(const ToolChain &TC, const 
ArgList &Args,
       !EffectiveTriple.isRISCV() && !EffectiveTriple.isLoongArch())
     return;
 
-  Args.addOptInFlag(CmdArgs, options::OPT_fstack_clash_protection,
-                    options::OPT_fno_stack_clash_protection);
+  if (Args.hasFlag(options::OPT_fstack_clash_protection,
+                   options::OPT_fno_stack_clash_protection,
+                   TC.isStackClashProtectionDefault()))
----------------
MaskRay wrote:

 The arch/OS gating in RenderSCPOptions already runs off getEffectiveTriple(), 
so this can be done without a new ToolChain hook:

```
 if (Args.hasFlag(options::OPT_fstack_clash_protection,
                  options::OPT_fno_stack_clash_protection,
                  EffectiveTriple.isAndroid()))
   CmdArgs.push_back("-fstack-clash-protection");
```

A virtual hook costs 53 * 8 bytes and 53 dynamic relocations in -pie/-shared 
links.

https://github.com/llvm/llvm-project/pull/209279
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to