]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
lto: Add & ~CF_SET into lto-opts.cc [PR119625]
authorJakub Jelinek <jakub@redhat.com>
Tue, 8 Apr 2025 09:53:34 +0000 (11:53 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 8 Apr 2025 09:53:34 +0000 (11:53 +0200)
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.

2025-04-08  Jakub Jelinek  <jakub@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

index 3959598b497cb49474922eb14856647dd6ee25e0..62a3fb28063616e6b3d2d6c1682acdbc4e70f683 100644 (file)
@@ -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;