------- Comment #12 from espindola at gcc dot gnu dot org 2010-01-15 15:28 ------- (In reply to comment #11) > GCC was configured with --disable-shared option. It seems that the driver does > not understand that --disable-shared implies static libgcc > That is correct. Currently we have
%{static|static-libgcc:-plugin-opt=-pass-through=%(lto_libgcc)} \ %{static:-plugin-opt=-pass-through=-lc} \ That is, --pass-through is only used for libgcc if -static or -static-libgcc is given. For libgcc we could probably find out if we are using a static one or not in a more accurate way. For libc it is harder. The driver doesn't know that libc is static. It just passes -lc to ld. It might be possible to change what we test for. I think it would be OK to always ask the plugin to pass libgcc and libc to the linker a second time *if they are being used at all*. My understanding is that an unnecessary static library will be ignored and a shared library will have no effect since it was already used anyway. To implement this we should always pass -plugin-opt=-pass-through=%(lto_libgcc) and -plugin-opt=-pass-through=-lc to the linker unless something like -nostdlib is used. What options other than -nostdlib prevent gcc from linking libgcc and libc in the produced binary? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42690