On Fri, 2018-06-08 at 11:17 +0000, Joseph Myers wrote: > 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). The problem with this is that num_linker_inputs isn't getting incremented when it sees a file to be turned into a precompiled header it gets incremented when it sees a linker flag like '-rpath'. The comments in driver::prepare_infiles make it seem like we are just processing a list of file names but when I use something like -Wl,- rpath=/foo, the -rpath flag shows up in the list of 'files' that this function is processing and that is what causes the routine to set explicit_link_files and trigger the link. Steve Ellcey sell...@cavium.com