[PATCH] Move LTO option processing to common code
Richard Guenther
rguenther@suse.de
Sat Oct 31 14:26:00 GMT 2009
As requested from Joseph this moves LTO option processing to
common code, -flto and -fwhopr are in common.opt already.
Bootstrapped and tested on x86_64-unknown-linux-gnu, ok?
Thanks,
Richard.
2009-10-31 Richard Guenther <rguenther@suse.de>
* c-opts.c (c_common_post_options): Move LTO option processing
code ...
* opts.c (decode_options): ... here.
fortran/
* options.c (gfc_post_options): Rely on common code processing
LTO options. Only enable -fwhole-file here.
Index: trunk/gcc/c-opts.c
===================================================================
*** trunk.orig/gcc/c-opts.c 2009-10-31 13:20:18.000000000 +0100
--- trunk/gcc/c-opts.c 2009-10-31 13:24:45.000000000 +0100
*************** c_common_post_options (const char **pfil
*** 1033,1061 ****
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 ())
--- 1033,1038 ----
Index: trunk/gcc/fortran/options.c
===================================================================
*** trunk.orig/gcc/fortran/options.c 2009-10-31 13:29:42.000000000 +0100
--- trunk/gcc/fortran/options.c 2009-10-31 13:29:45.000000000 +0100
*************** gfc_post_options (const char **pfilename
*** 242,268 ****
if (flag_whole_program)
gfc_option.flag_whole_file = 1;
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;
!
! /* But do enable whole-file mode. */
! gfc_option.flag_whole_file = 1;
! #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");
/* -fbounds-check is equivalent to -fcheck=bounds */
if (flag_bounds_check)
--- 242,250 ----
if (flag_whole_program)
gfc_option.flag_whole_file = 1;
+ /* Enable whole-file mode if LTO is in effect. */
if (flag_lto || flag_whopr)
! gfc_option.flag_whole_file = 1;
/* -fbounds-check is equivalent to -fcheck=bounds */
if (flag_bounds_check)
Index: trunk/gcc/opts.c
===================================================================
*** trunk.orig/gcc/opts.c 2009-10-31 13:20:18.000000000 +0100
--- trunk/gcc/opts.c 2009-10-31 13:24:44.000000000 +0100
*************** decode_options (unsigned int argc, const
*** 1117,1122 ****
--- 1117,1144 ----
PARAM_VALUE (PARAM_STACK_FRAME_GROWTH) = 40;
}
+ 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");
}
#define LEFT_COLUMN 27
More information about the Gcc-patches
mailing list