This is the mail archive of the
mailing list for the GCC project.
Re: speedup collect2 (by not using it)
- From: Zack Weinberg <zack at codesourcery dot com>
- To: Mike Stump <mrs at apple dot com>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 22 May 2003 13:02:29 -0700
- Subject: Re: speedup collect2 (by not using it)
- References: <7E891706-8C8C-11D7-8138-003065A77310@apple.com>
Mike Stump <email@example.com> writes:
> These patches speed up compiles by around 2.8% on Finder_FE by not
> trying to using collect2 when it isn't necessary. This is about 62ms
> per compile. If collect2 is in use for collecting (USE_COLLECT2 is
> defined), then these changes don't have any effect, otherwise, if
> -frepo is given, collect2 is used, otherwise, we use ld as normal.
> So, the question is, does collect2 ever do anything interesting when
> USE_COLLECT2 isn't defined and -frepo isn't given? Problem areas
> might be IBM (COLLECT_EXPORT_LIST). If aix is a problem, we can
> always do collect2 when COLLECT_EXPORT_LIST is defined.
I think this is a fine idea in principle. We need to nail down
precisely what collect2 is or is not used for, of course, and make
sure it's invoked when necessary.
> Another question would be, do we trust gcc.c to be able to find ld as
> well as collect2.c can find ld? :-( Answer should be yes, but in
> practice, there could be bugs.
Given that the exact same code is relied on to find the assembler, and
given that GCC used to invoke the linker directly if !USE_COLLECT2
(before there was -frepo) I think the risk of this is low. Better
check unified tree builds and the like, though.
> * tlink.c (scan_linker_output): Add support for darwin linker, as it
> emits unresolved symbols one per line, consuming entire line.
Unrelated change, please submit separately.
> ! #ifndef USE_COLLECT2
> ! /* On a system that doesn't define USE_COLLECT2, we don't run collect2
> ! for any reason other than -frepo. */
> ! /* If we have no other reason to run collect2, don't. */
> ! if (repo_flag)
> ! #endif
> ! s = find_a_file (&exec_prefixes, "collect2", X_OK, 0);
Would you mind restructuring things such that we don't have an #ifdef
here? Put, say,
#define USE_COLLECT2 0
at the top of the file, and then you can write
if (USE_COLLECT2 || repo_flag)
s = find_a_file (...);
which is neater.