diff options
author | Richard Guenther <rguenther@suse.de> | 2011-11-08 13:41:57 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2011-11-08 13:41:57 +0000 |
commit | a456676fbc49400e55342117b19db664b94a7906 (patch) | |
tree | 03ac2f68c385ce43daa774280e5f0b9e39c3f717 /gcc | |
parent | a0eabe5751e3ca92ae6673936c9b73db85bbfb67 (diff) | |
download | gcc-a456676fbc49400e55342117b19db664b94a7906.zip gcc-a456676fbc49400e55342117b19db664b94a7906.tar.gz gcc-a456676fbc49400e55342117b19db664b94a7906.tar.bz2 |
re PR regression/50999 (g++.dg/lto/20081109 execute -O2 -flto -flto-partition=1to1 -fno-use-linker-plugin)
2011-11-08 Richard Guenther <rguenther@suse.de>
PR lto/50999
* lto-opts.c (append_to_collect_gcc_options): Split out from...
(lto_write_options): ... here. Prepend frontend specific flags.
From-SVN: r181160
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/lto-opts.c | 68 |
2 files changed, 47 insertions, 27 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 47387a7..6c92689 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2011-11-08 Richard Guenther <rguenther@suse.de> + + PR lto/50999 + * lto-opts.c (append_to_collect_gcc_options): Split out from... + (lto_write_options): ... here. Prepend frontend specific flags. + 2011-11-08 Jakub Jelinek <jakub@redhat.com> * config/i386/sse.md (*avx_vperm2f128<mode>3_nozero): Emit mask diff --git a/gcc/lto-opts.c b/gcc/lto-opts.c index 47f73aa..668a5ce 100644 --- a/gcc/lto-opts.c +++ b/gcc/lto-opts.c @@ -35,6 +35,29 @@ along with GCC; see the file COPYING3. If not see #include "lto-streamer.h" #include "toplev.h" +/* Append the option piece OPT to the COLLECT_GCC_OPTIONS string + set up by OB, appropriately quoted and separated by spaces + (if !*FIRST_P). */ + +static void +append_to_collect_gcc_options (struct obstack *ob, + bool *first_p, const char *opt) +{ + const char *p, *q = opt; + if (!first_p) + obstack_grow (ob, " ", 1); + obstack_grow (ob, "'", 1); + while ((p = strchr (q, '\''))) + { + obstack_grow (ob, q, p - q); + obstack_grow (ob, "'\\''", 4); + q = ++p; + } + obstack_grow (ob, q, strlen (q)); + obstack_grow (ob, "'", 1); + *first_p = false; +} + /* Write currently held options to an LTO IL section. */ void @@ -45,16 +68,30 @@ lto_write_options (void) struct obstack temporary_obstack; unsigned int i, j; char *args; + bool first_p = true; section_name = lto_get_section_name (LTO_section_opts, NULL, NULL); lto_begin_section (section_name, false); memset (&stream, 0, sizeof (stream)); obstack_init (&temporary_obstack); + + /* Output options that affect GIMPLE IL semantics and are implicitely + enabled by the frontend. + This for now includes an explicit set of options that we also handle + explicitly in lto-wrapper.c. In the end the effects on GIMPLE IL + semantics should be explicitely encoded in the IL or saved per + function rather than per compilation unit. */ + /* -fexceptions causes the EH machinery to be initialized, enabling + generation of unwind data so that explicit throw() calls work. */ + if (global_options.x_flag_exceptions) + append_to_collect_gcc_options (&temporary_obstack, &first_p, + "-fexceptions"); + + /* Output explicitely passed options. */ for (i = 1; i < save_decoded_options_count; ++i) { struct cl_decoded_option *option = &save_decoded_options[i]; - const char *q, *p; /* Skip frontend and driver specific options here. */ if (!(cl_options[option->opt_index].flags & (CL_COMMON|CL_TARGET|CL_LTO))) @@ -82,32 +119,9 @@ lto_write_options (void) break; } - if (i != 1) - obstack_grow (&temporary_obstack, " ", 1); - obstack_grow (&temporary_obstack, "'", 1); - q = option->canonical_option[0]; - while ((p = strchr (q, '\''))) - { - obstack_grow (&temporary_obstack, q, p - q); - obstack_grow (&temporary_obstack, "'\\''", 4); - q = ++p; - } - obstack_grow (&temporary_obstack, q, strlen (q)); - obstack_grow (&temporary_obstack, "'", 1); - - for (j = 1; j < option->canonical_option_num_elements; ++j) - { - obstack_grow (&temporary_obstack, " '", 2); - q = option->canonical_option[j]; - while ((p = strchr (q, '\''))) - { - obstack_grow (&temporary_obstack, q, p - q); - obstack_grow (&temporary_obstack, "'\\''", 4); - q = ++p; - } - obstack_grow (&temporary_obstack, q, strlen (q)); - obstack_grow (&temporary_obstack, "'", 1); - } + for (j = 0; j < option->canonical_option_num_elements; ++j) + append_to_collect_gcc_options (&temporary_obstack, &first_p, + option->canonical_option[j]); } obstack_grow (&temporary_obstack, "\0", 1); args = XOBFINISH (&temporary_obstack, char *); |