[lto][plugin] How to find libc?

Rafael Espindola espindola@google.com
Thu Oct 1 00:20:00 GMT 2009

Ian noted that when linking libc statically into a program and using
the gold plugin, we have to ask gold to rescan libc. The problem is,
gcc normally doesn't know which libc is being used. It will just pass
-lc to the linker and the linker searches for it.

On way to fix this is to implement the same algorithms used in the
linker in gcc.

Another way is to add a new callback into gold: add_input_library. It
would be similar to add_input_file, but the linker would search for
library. With this callback we would be able to do

-pass-through=libgcc.a -pass-through=-lc

Opinions? Suggestions?

Rafael Ávila de Espíndola

More information about the Gcc-patches mailing list