This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [gold] If a library is listed twice, should the incremental info list it twice?
- From: Ian Lance Taylor <iant at google dot com>
- To: Rafael Espindola <espindola at google dot com>
- Cc: Binutils <binutils at sourceware dot org>, Mikolaj Zalewski <mikolajz at google dot com>
- Date: Mon, 07 Dec 2009 14:23:04 -0800
- Subject: Re: [gold] If a library is listed twice, should the incremental info list it twice?
- References: <38a0d8450912071413i65289951j1240ebb73306ba15@mail.gmail.com>
Rafael Espindola <espindola@google.com> writes:
> A common ld invocation looks like
>
> ld .... -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed
> -lgcc_s --no-as-needed ...
>
> Currently we list libgcc ( and libgcc_s) twice. Is this by design?
> Since we know that the command line is the same, it looks redundant to
> list the library again.
This is really a gcc question, not a binutils question, but in any
case it is by design. Some functions in -lgcc depend upon -lc, so it
must be listed first. But if -lc is compiled with gcc, then some
functions in -lc may depend upon -lgcc, so it must be listed last. So
we list it in both places.
The functions in -lgcc which require -lc are functions which are
invoked for special cases not used in -lc, such as __clear_cache. So
it should never be the case in practice that a function in -lc
requires a function in -lgcc which requires a function in -lc. If
that ever happens for a good reason, things will get even more
complicated.
Ian