------- Comment #5 from espindola at gcc dot gnu dot org 2010-01-15 03:54 ------- Note that -plugin-opt=-pass-through=/foo/bar/libgcc.a is missing in the linker invocation.
That is the problem. When BUG is not defined, the undefined reference is visible early on. You can check that with GNUTARGET=plugin nm --prugin ..../libltoplugin.so foo.o If BUG is defined the plugin will not see a call since it will only created by codegen. That is why the driver asks the linker to take a second look at some libraries by passing the pass-through option. We have to figure out a better way to detected in gcc.c that libgcc (and/or libc) will be linked statically. H.J.Lu: You are probably linking with a shared libgcc, no? -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42690