This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug lto/63603] [4.9/5 Regression] Linking with -fno-lto still invokes LTO
- From: "rguenther at suse dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 21 Oct 2014 11:24:11 +0000
- Subject: [Bug lto/63603] [4.9/5 Regression] Linking with -fno-lto still invokes LTO
- Auto-submitted: auto-generated
- References: <bug-63603-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63603
--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On Tue, 21 Oct 2014, burnus at gcc dot gnu.org wrote:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63603
>
> --- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> ---
> (In reply to Tobias Burnus from comment #2)
> > COLLECT_GCC_OPTIONS='-v' '-fno-use-linker-plugin' '-fno-lto'
> > '-mtune=generic' '-march=x86-64'
> > [...]/collect2 [...]
>
> I haven't shown it, but the collect2 arguments doesn't contain the -fno-lto,
> only COLLECT_GCC_OPTIONS has it.
>
> And in collect2.c's main(), there is a check for
> else if (!strncmp (argv[i], "-fno-lto", 8))
> lto_mode = LTO_MODE_NONE;
> but that only operates on argv and not on COLLECT_GCC_OPTIONS.
That means that
/* We pass any -flto flags on to the linker, which is expected
to understand them. In practice, this means it had better be collect2.
*/
/* %{e*} includes -export-dynamic; see comment in common.opt. */
#ifndef LINK_COMMAND_SPEC
#define LINK_COMMAND_SPEC "\
%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\
%(linker) " \
LINK_PLUGIN_SPEC \
"%{flto|flto=*:%<fcompare-debug*} \
%{flto} %{flto=*} %l " LINK_PIE_SPEC \
doesn't pass on -fno-lto as expected. Does adding %{fno-lto} after
%{flto} work?