summaryrefslogtreecommitdiff
path: root/gcc/c-opts.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/c-opts.c')
-rw-r--r--gcc/c-opts.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index e026fd97dc7..6c2f5a59cd3 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -1033,6 +1033,29 @@ c_common_post_options (const char **pfilename)
C_COMMON_OVERRIDE_OPTIONS;
#endif
+ if (flag_lto || flag_whopr)
+ {
+#ifdef ENABLE_LTO
+ flag_generate_lto = 1;
+
+ /* When generating IL, do not operate in whole-program mode.
+ Otherwise, symbols will be privatized too early, causing link
+ errors later. */
+ flag_whole_program = 0;
+
+ /* FIXME lto. Disable var-tracking until debug information
+ is properly handled in free_lang_data. */
+ flag_var_tracking = 0;
+#else
+ error ("LTO support has not been enabled in this configuration");
+#endif
+ }
+
+ /* Reconcile -flto and -fwhopr. Set additional flags as appropriate and
+ check option consistency. */
+ if (flag_lto && flag_whopr)
+ error ("-flto and -fwhopr are mutually exclusive");
+
/* Excess precision other than "fast" requires front-end
support. */
if (c_dialect_cxx ())