[gold] If a library is listed twice, should the incremental info list it twice?
Ian Lance Taylor
iant@google.com
Mon Dec 7 22:23:00 GMT 2009
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
More information about the Binutils
mailing list