Hi!

The following patch uses & ~CF_SET so that we get the -fcf-protection=
options into .gnu.lto_.opts section even when it has CF_SET bit set.

Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?

2025-04-08  Jakub Jelinek  <ja...@redhat.com>

        PR lto/119625
        * lto-opts.cc (lto_write_options): Mask of CF_SET from
        global_options.x_flag_cf_protection.

--- gcc/lto-opts.cc.jj  2025-04-04 20:57:05.473405947 +0200
+++ gcc/lto-opts.cc     2025-04-07 20:03:51.281901904 +0200
@@ -97,7 +97,7 @@ lto_write_options (void)
   if (!OPTION_SET_P (flag_cf_protection))
     {
       const char *cf_protection = NULL;
-      switch (global_options.x_flag_cf_protection)
+      switch (global_options.x_flag_cf_protection & ~CF_SET)
        {
        case CF_NONE: cf_protection = "-fcf-protection=none"; break;
        case CF_FULL: cf_protection = "-fcf-protection=full"; break;

        Jakub

Reply via email to