[LTO merge][1/15][RFA] C front end

Diego Novillo dnovillo@google.com
Tue Sep 29 01:10:00 GMT 2009


This patch adds handling of the LTO options to the C front end.

It has been tested on x86_64 together with the the other 14
patches in this merge.

See http://gcc.gnu.org/ml/gcc/2009-09/msg00578.html for a
description of the whole set.

2009-09-28  Diego Novillo  <dnovillo@google.com>

	* c.opt: Add LTO to warn_abi and warn_psabi.

2009-09-28  Ollie Wild  <aaw@google.com>

	* c-opts.c (c_common_post_options): Handle -flto and -fwhopr.

diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/gcc/c.opt /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/gcc/c.opt
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/gcc/c.opt	2009-09-23 12:45:47.000000000 -0400
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/gcc/c.opt	2009-09-23 11:15:13.000000000 -0400
@@ -113,11 +113,11 @@ C ObjC C++ ObjC++ Joined Separate
 -U<macro>	Undefine <macro>
 
 Wabi
-C ObjC C++ ObjC++ Var(warn_abi) Warning
+C ObjC C++ ObjC++ LTO Var(warn_abi) Warning
 Warn about things that will change when compiling with an ABI-compliant compiler
 
 Wpsabi
-C ObjC C++ ObjC++ Var(warn_psabi) Init(1) Undocumented
+C ObjC C++ ObjC++ LTO Var(warn_psabi) Init(1) Undocumented
 
 Waddress
 C ObjC C++ ObjC++ Var(warn_address) Warning
diff -rdupN --exclude=.svn --exclude=.git --exclude='*.diff*' --exclude='autom4te*' --exclude=tags --exclude=ChangeLog.lto --exclude=configure /usr/local/google/homedirs/dnovillo/gcc/trunk/gcc/c-opts.c /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/gcc/c-opts.c
--- /usr/local/google/homedirs/dnovillo/gcc/trunk/gcc/c-opts.c	2009-09-23 12:45:47.000000000 -0400
+++ /usr/local/google/homedirs/dnovillo/gcc/trunk.lto/gcc/c-opts.c	2009-09-23 11:15:22.000000000 -0400
@@ -1035,6 +1035,29 @@ c_common_post_options (const char **pfil
   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 ())



More information about the Gcc-patches mailing list