aboutsummaryrefslogtreecommitdiff
path: root/gcc/lto-opts.c
diff options
context:
space:
mode:
authorMatthias Klose <doko@ubuntu.com>2020-07-14 10:12:08 +0200
committerMatthias Klose <doko@ubuntu.com>2020-07-14 10:12:08 +0200
commit6a48d12475cdb7375b98277f8bc089715feeeafe (patch)
tree4a9e567562d83843e1d1b75ec5affdfa810add2d /gcc/lto-opts.c
parent9ad19a66d751ab48515ef61f830e192ae4078b93 (diff)
downloadgcc-6a48d12475cdb7375b98277f8bc089715feeeafe.zip
gcc-6a48d12475cdb7375b98277f8bc089715feeeafe.tar.gz
gcc-6a48d12475cdb7375b98277f8bc089715feeeafe.tar.bz2
LTO: pick up -fcf-protection flag for the link step
2020-07-14 Matthias Klose <doko@ubuntu.com> PR lto/95604 * lto-wrapper.c (merge_and_complain): Add decoded options as parameter, error on different values for -fcf-protection. (append_compiler_options): Pass -fcf-protection option. (find_and_merge_options): Add decoded options as parameter, pass decoded_options to merge_and_complain. (run_gcc): Pass decoded options to find_and_merge_options. * lto-opts.c (lto_write_options): Pass -fcf-protection option.
Diffstat (limited to 'gcc/lto-opts.c')
-rw-r--r--gcc/lto-opts.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c
index 2512560..960e4e7 100644
--- a/gcc/lto-opts.c
+++ b/gcc/lto-opts.c
@@ -94,6 +94,21 @@ lto_write_options (void)
: "-fno-pie");
}
+ if (!global_options_set.x_flag_cf_protection)
+ {
+ append_to_collect_gcc_options (
+ &temporary_obstack, &first_p,
+ global_options.x_flag_cf_protection == CF_NONE
+ ? "-fcf-protection=none"
+ : global_options.x_flag_cf_protection == CF_FULL
+ ? "-fcf-protection=full"
+ : global_options.x_flag_cf_protection == CF_BRANCH
+ ? "-fcf-protection=branch"
+ : global_options.x_flag_cf_protection == CF_RETURN
+ ? "-fcf-protection=return"
+ : "");
+ }
+
/* If debug info is enabled append -g. */
if (debug_info_level > DINFO_LEVEL_NONE)
append_to_collect_gcc_options (&temporary_obstack, &first_p, "-g");