From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32156 invoked by alias); 15 Jan 2010 03:55:03 -0000 Received: (qmail 31987 invoked by uid 48); 15 Jan 2010 03:54:53 -0000 Date: Fri, 15 Jan 2010 03:55:00 -0000 Message-ID: <20100115035453.31986.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug lto/42690] Undefined reference errors with -flto -fuse-linker-plugin In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "espindola at gcc dot gnu dot org" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-01/txt/msg01826.txt.bz2 ------- 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