This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch] Do not call the linker if we are creating precompiled header files
- From: Joseph Myers <joseph at codesourcery dot com>
- To: Steve Ellcey <sellcey at cavium dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 Jun 2018 11:17:44 +0000
- Subject: Re: [Patch] Do not call the linker if we are creating precompiled header files
- References: <1525290467.28825.24.camel@cavium.com>
On Wed, 2 May 2018, Steve Ellcey wrote:
> I tracked this down to driver::maybe_run_linker where it sees the linker
> flags and increments num_linker_inputs, this causes the routine to call
> the linker. This patch checks to see if we are creating precompiled
> header files and avoids calling the linker in that case.
Making it a global check like this, with an early exit from
driver::maybe_run_linker, seems wrong to me. I think the correct logical
check is, for each output file, whether it is a precompiled header - if it
is, then num_linker_inputs should not be incremented for that particular
output file (but if there are other output files that are not precompiled
headers, or if there are linker input files, num_linker_inputs should
still be incremented for *those*). Then the existing logic in the rest of
driver::maybe_run_linker should run as usual (including the logic to warn
about explicit linker input files when linking is not done).
--
Joseph S. Myers
joseph@codesourcery.com