From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30538 invoked by alias); 15 Jan 2010 15:29:06 -0000 Received: (qmail 30505 invoked by uid 48); 15 Jan 2010 15:28:52 -0000 Date: Fri, 15 Jan 2010 15:29:00 -0000 Message-ID: <20100115152852.30504.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug driver/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/msg01888.txt.bz2 ------- 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