From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4372 invoked by alias); 24 Nov 2010 15:07:36 -0000 Received: (qmail 4354 invoked by uid 22791); 24 Nov 2010 15:07:35 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 24 Nov 2010 15:07:31 +0000 From: "hjl.tools at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug driver/42690] Undefined reference errors with -flto -fuse-linker-plugin X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: driver X-Bugzilla-Keywords: lto, patch X-Bugzilla-Severity: normal X-Bugzilla-Who: hjl.tools at gmail dot com X-Bugzilla-Status: ASSIGNED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: davek at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Wed, 24 Nov 2010 15:14:00 -0000 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-11/txt/msg02990.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42690 --- Comment #30 from H.J. Lu 2010-11-24 15:07:17 UTC --- Goal: We should preserve the same linker command line order as if there are no IR. Problem: a. LTO may generate extra symbol references which aren't in IR. b. It was worked around with -pass-through hack. But it doesn't preserve the link command line order. Proposal: a. Remove -pass-through hack. b. GCC always passes the same command line to linker, with or without LTO. The only additions for LTO are LTO options. c. For linker: i. For a .o or DSO file on command line, don't process it. 1) Present it to LTO: a) If it isn't claimed by LTO, send it to LTO as pass-through. ii. For an archive or linker script on command line: 1) Present it to LTO recursively 2) Send it to LTO as pass-through after it has been processed recursively. d. For LTO: i. Send translated files as well as pass-through files to linker in the same order in which they are presented from linker.