public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Fix -fno-lto (PR lto/46905)
@ 2010-12-16 13:25 Andi Kleen
  2010-12-16 13:26 ` [PATCH 2/2] Improve reporting of section conflict errors Andi Kleen
  2010-12-16 13:29 ` [PATCH 1/2] Fix -fno-lto (PR lto/46905) Richard Guenther
  0 siblings, 2 replies; 18+ messages in thread
From: Andi Kleen @ 2010-12-16 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andi Kleen

From: Andi Kleen <ak@linux.intel.com>

This fixes PR lto/46905.

It's sometimes convenient in large Makefiles to globally enable LTO
in CFLAGS, but disable it again for specific files. The simplest
way to do that is appending -fno-lto, but that didn't work.
Add explicit code to handle this case.

Passes bootstrap and full test on x86_64-linux. Ok?

gcc/

2010-12-15  Andi Kleen	<ak@linux.intel.com>

	PR lto/46905
	* collect2.c (main): Handle -fno-lto.
	* common.opt (fno-lto): Add.
	* opts.c (common_handle_option): Handle OPT_fno_lto.
---
 gcc/collect2.c |    2 ++
 gcc/common.opt |    4 ++++
 gcc/opts.c     |    4 ++++
 3 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/gcc/collect2.c b/gcc/collect2.c
index 89b21d5..77f794f 100644
--- a/gcc/collect2.c
+++ b/gcc/collect2.c
@@ -1211,6 +1211,8 @@ main (int argc, char **argv)
         else if ((! strncmp (argv[i], "-flto=", 6)
 		  || ! strcmp (argv[i], "-flto")) && ! use_plugin)
 	  lto_mode = LTO_MODE_WHOPR;
+	else if (!strncmp (argv[i], "-fno-lto", 8))
+	  lto_mode = LTO_MODE_NONE;
         else if (! strcmp (argv[i], "-plugin"))
 	  {
 	    use_plugin = true;
diff --git a/gcc/common.opt b/gcc/common.opt
index 32df6fc..e6cb5e4 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -1302,6 +1302,10 @@ floop-optimize
 Common Ignore
 Does nothing.  Preserved for backward compatibility.
 
+fno-lto
+Common RejectNegative
+Disable link-time optimization
+
 flto
 Common
 Enable link-time optimization.
diff --git a/gcc/opts.c b/gcc/opts.c
index 2c8e767..fc6f272 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -1673,6 +1673,10 @@ common_handle_option (struct gcc_options *opts,
       opts->x_flag_lto = "";
       break;
 
+    case OPT_fno_lto:
+      opts->x_flag_lto = NULL;
+      break;
+
     case OPT_w:
       dc->dc_inhibit_warnings = true;
       break;
-- 
1.7.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2010-12-19 19:37 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-12-16 13:25 [PATCH 1/2] Fix -fno-lto (PR lto/46905) Andi Kleen
2010-12-16 13:26 ` [PATCH 2/2] Improve reporting of section conflict errors Andi Kleen
2010-12-16 13:32   ` Richard Guenther
2010-12-16 15:39     ` Andi Kleen
2010-12-16 15:46       ` Richard Guenther
2010-12-16 15:53         ` Andi Kleen
2010-12-16 16:56           ` Joseph S. Myers
2010-12-16 17:24             ` Andi Kleen
2010-12-16 20:37             ` H.J. Lu
2010-12-16 14:01   ` Nathan Froyd
2010-12-16 13:29 ` [PATCH 1/2] Fix -fno-lto (PR lto/46905) Richard Guenther
2010-12-16 13:30   ` Andi Kleen
2010-12-16 13:45     ` Richard Guenther
2010-12-16 16:09       ` Jan Hubicka
2010-12-16 16:44       ` Joseph S. Myers
2010-12-16 18:14         ` Andi Kleen
2010-12-18 20:44           ` Richard Guenther
2010-12-20  5:05             ` Andi Kleen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).