From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21819 invoked by alias); 16 Dec 2010 13:17:16 -0000 Received: (qmail 21713 invoked by uid 22791); 16 Dec 2010 13:17:14 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-iw0-f175.google.com (HELO mail-iw0-f175.google.com) (209.85.214.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Dec 2010 13:17:08 +0000 Received: by iwn8 with SMTP id 8so3576717iwn.20 for ; Thu, 16 Dec 2010 05:17:05 -0800 (PST) MIME-Version: 1.0 Received: by 10.231.13.197 with SMTP id d5mr6176946iba.6.1292505425174; Thu, 16 Dec 2010 05:17:05 -0800 (PST) Received: by 10.231.15.2 with HTTP; Thu, 16 Dec 2010 05:17:05 -0800 (PST) In-Reply-To: <1292503308-11258-1-git-send-email-andi@firstfloor.org> References: <1292503308-11258-1-git-send-email-andi@firstfloor.org> Date: Thu, 16 Dec 2010 13:29:00 -0000 Message-ID: Subject: Re: [PATCH 1/2] Fix -fno-lto (PR lto/46905) From: Richard Guenther To: Andi Kleen Cc: gcc-patches@gcc.gnu.org, Andi Kleen Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org X-SW-Source: 2010-12/txt/msg01302.txt.bz2 On Thu, Dec 16, 2010 at 1:41 PM, Andi Kleen wrote: > From: Andi Kleen > > 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? Do you really need the common.opt and opts.c hunks? > gcc/ > > 2010-12-15 =A0Andi Kleen =A0 > > =A0 =A0 =A0 =A0PR lto/46905 > =A0 =A0 =A0 =A0* collect2.c (main): Handle -fno-lto. > =A0 =A0 =A0 =A0* common.opt (fno-lto): Add. > =A0 =A0 =A0 =A0* opts.c (common_handle_option): Handle OPT_fno_lto. > --- > =A0gcc/collect2.c | =A0 =A02 ++ > =A0gcc/common.opt | =A0 =A04 ++++ > =A0gcc/opts.c =A0 =A0 | =A0 =A04 ++++ > =A03 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) > =A0 =A0 =A0 =A0 else if ((! strncmp (argv[i], "-flto=3D", 6) > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0|| ! strcmp (argv[i], "-flto")) && ! u= se_plugin) > =A0 =A0 =A0 =A0 =A0lto_mode =3D LTO_MODE_WHOPR; > + =A0 =A0 =A0 else if (!strncmp (argv[i], "-fno-lto", 8)) > + =A0 =A0 =A0 =A0 lto_mode =3D LTO_MODE_NONE; > =A0 =A0 =A0 =A0 else if (! strcmp (argv[i], "-plugin")) > =A0 =A0 =A0 =A0 =A0{ > =A0 =A0 =A0 =A0 =A0 =A0use_plugin =3D 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 > =A0Common Ignore > =A0Does nothing. =A0Preserved for backward compatibility. > > +fno-lto > +Common RejectNegative > +Disable link-time optimization > + > =A0flto > =A0Common > =A0Enable 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, > =A0 =A0 =A0 opts->x_flag_lto =3D ""; > =A0 =A0 =A0 break; > > + =A0 =A0case OPT_fno_lto: > + =A0 =A0 =A0opts->x_flag_lto =3D NULL; > + =A0 =A0 =A0break; > + > =A0 =A0 case OPT_w: > =A0 =A0 =A0 dc->dc_inhibit_warnings =3D true; > =A0 =A0 =A0 break; > -- > 1.7.1 > >