diff options
author | Richard Biener <rguenther@suse.de> | 2014-03-06 08:48:01 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2014-03-06 08:48:01 +0000 |
commit | f3ba16d0589db7548b76f381102759f2c4cc7558 (patch) | |
tree | fa7f9924d2c5057881344899e74b9fd4ecc3993d /gcc/lto-wrapper.c | |
parent | df2b279c5c77f5925e85246f3dbdad92508c573b (diff) | |
download | gcc-f3ba16d0589db7548b76f381102759f2c4cc7558.zip gcc-f3ba16d0589db7548b76f381102759f2c4cc7558.tar.gz gcc-f3ba16d0589db7548b76f381102759f2c4cc7558.tar.bz2 |
gcc.c (PLUGIN_COND): Always enable unless -fno-use-linker-plugin or -fno-lto is specified and the...
2014-03-06 Richard Biener <rguenther@suse.de>
* gcc.c (PLUGIN_COND): Always enable unless -fno-use-linker-plugin
or -fno-lto is specified and the linker has full plugin support.
* collect2.c (lto_mode): Default to LTO_MODE_WHOPR if LTO is
enabled.
(main): Remove -flto processing, adjust lto_mode using
use_plugin late.
* lto-wrapper.c (merge_and_complain): Merge compile-time
optimization levels.
(run_gcc): And pass it through to the link options.
From-SVN: r208375
Diffstat (limited to 'gcc/lto-wrapper.c')
-rw-r--r-- | gcc/lto-wrapper.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/gcc/lto-wrapper.c b/gcc/lto-wrapper.c index b17945a..cf587cb 100644 --- a/gcc/lto-wrapper.c +++ b/gcc/lto-wrapper.c @@ -459,6 +459,77 @@ merge_and_complain (struct cl_decoded_option **decoded_options, fatal ("Option %s not used consistently in all LTO input files", foption->orig_option_with_args_text); break; + + case OPT_O: + case OPT_Ofast: + case OPT_Og: + case OPT_Os: + for (j = 0; j < *decoded_options_count; ++j) + if ((*decoded_options)[j].opt_index == OPT_O + || (*decoded_options)[j].opt_index == OPT_Ofast + || (*decoded_options)[j].opt_index == OPT_Og + || (*decoded_options)[j].opt_index == OPT_Os) + break; + if (j == *decoded_options_count) + append_option (decoded_options, decoded_options_count, foption); + else if ((*decoded_options)[j].opt_index == foption->opt_index + && foption->opt_index != OPT_O) + /* Exact same options get merged. */ + ; + else + { + /* For mismatched option kinds preserve the optimization + level only, thus merge it as -On. This also handles + merging of same optimization level -On. */ + int level = 0; + switch (foption->opt_index) + { + case OPT_O: + if (foption->arg[0] == '\0') + level = MAX (level, 1); + else + level = MAX (level, atoi (foption->arg)); + break; + case OPT_Ofast: + level = MAX (level, 3); + break; + case OPT_Og: + level = MAX (level, 1); + break; + case OPT_Os: + level = MAX (level, 2); + break; + default: + gcc_unreachable (); + } + switch ((*decoded_options)[j].opt_index) + { + case OPT_O: + if ((*decoded_options)[j].arg[0] == '\0') + level = MAX (level, 1); + else + level = MAX (level, atoi ((*decoded_options)[j].arg)); + break; + case OPT_Ofast: + level = MAX (level, 3); + break; + case OPT_Og: + level = MAX (level, 1); + break; + case OPT_Os: + level = MAX (level, 2); + break; + default: + gcc_unreachable (); + } + (*decoded_options)[j].opt_index = OPT_O; + char *tem; + asprintf (&tem, "-O%d", level); + (*decoded_options)[j].arg = &tem[2]; + (*decoded_options)[j].canonical_option[0] = tem; + (*decoded_options)[j].value = 1; + } + break; } } } @@ -610,6 +681,10 @@ run_gcc (unsigned argc, char *argv[]) case OPT_fwrapv: case OPT_ftrapv: case OPT_fstrict_overflow: + case OPT_O: + case OPT_Ofast: + case OPT_Og: + case OPT_Os: break; default: |