aboutsummaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
authorDiego Novillo <dnovillo@gcc.gnu.org>2009-10-03 17:10:11 -0400
committerDiego Novillo <dnovillo@gcc.gnu.org>2009-10-03 17:10:11 -0400
commitd7f09764d7bc66b9997c811c22e11efc87b44792 (patch)
tree3a9882bd235e5026410e5397a5e46a97ece50b48 /gcc/opts.c
parentb06e51a0c9852e7fb7c6f589b46f6906ce48febd (diff)
downloadgcc-d7f09764d7bc66b9997c811c22e11efc87b44792.zip
gcc-d7f09764d7bc66b9997c811c22e11efc87b44792.tar.gz
gcc-d7f09764d7bc66b9997c811c22e11efc87b44792.tar.bz2
Merge lto branch into trunk.
From-SVN: r152434
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index 878635f8..fee1c6b 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "plugin.h"
#include "except.h"
+#include "lto-streamer.h"
/* Value of the -G xx switch, and whether it was passed or not. */
unsigned HOST_WIDE_INT g_switch_value;
@@ -432,6 +433,17 @@ complain_wrong_lang (const char *text, const struct cl_option *option,
{
char *ok_langs, *bad_lang;
+ /* The LTO front end inherits all the options from the first front
+ end that was used. However, not all the original front end
+ options make sense in LTO.
+
+ A real solution would be to filter this in collect2, but collect2
+ does not have access to all the option attributes to know what to
+ filter. So, in lto1 we silently accept inherited flags and do
+ nothing about it. */
+ if (lang_mask & CL_LTO)
+ return;
+
ok_langs = write_langs (option->flags);
bad_lang = write_langs (lang_mask);
@@ -626,16 +638,28 @@ handle_option (const char **argv, unsigned int lang_mask)
}
if (option->flags & lang_mask)
- if (lang_hooks.handle_option (opt_index, arg, value) == 0)
- result = 0;
+ {
+ if (lang_hooks.handle_option (opt_index, arg, value) == 0)
+ result = 0;
+ else
+ lto_register_user_option (opt_index, arg, value, lang_mask);
+ }
if (result && (option->flags & CL_COMMON))
- if (common_handle_option (opt_index, arg, value, lang_mask) == 0)
- result = 0;
+ {
+ if (common_handle_option (opt_index, arg, value, lang_mask) == 0)
+ result = 0;
+ else
+ lto_register_user_option (opt_index, arg, value, CL_COMMON);
+ }
if (result && (option->flags & CL_TARGET))
- if (!targetm.handle_option (opt_index, arg, value))
- result = 0;
+ {
+ if (!targetm.handle_option (opt_index, arg, value))
+ result = 0;
+ else
+ lto_register_user_option (opt_index, arg, value, CL_TARGET);
+ }
done:
if (dup)
@@ -958,6 +982,9 @@ decode_options (unsigned int argc, const char **argv)
flag_unwind_tables = targetm.unwind_tables_default;
}
+ /* Clear any options currently held for LTO. */
+ lto_clear_user_options ();
+
#ifdef OPTIMIZATION_OPTIONS
/* Allow default optimizations to be specified on a per-machine basis. */
OPTIMIZATION_OPTIONS (optimize, optimize_size);