From patchwork Fri Mar 11 12:30:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 86415 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 88228B6EF7 for ; Fri, 11 Mar 2011 23:30:20 +1100 (EST) Received: (qmail 14316 invoked by alias); 11 Mar 2011 12:30:18 -0000 Received: (qmail 14288 invoked by uid 22791); 11 Mar 2011 12:30:16 -0000 X-SWARE-Spam-Status: No, hits=-3.4 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 11 Mar 2011 12:30:07 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) by mx2.suse.de (Postfix) with ESMTP id A424587104; Fri, 11 Mar 2011 13:30:04 +0100 (CET) Date: Fri, 11 Mar 2011 13:30:04 +0100 (CET) From: Richard Guenther To: Rainer Orth Cc: gcc-patches@gcc.gnu.org, Paolo Bonzini Subject: Re: [build, lto] Only accept -fuse-linker-plugin if linker supports -plugin (PR lto/46944) In-Reply-To: Message-ID: References: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Thu, 10 Mar 2011, Rainer Orth wrote: > Richard Guenther writes: > > >> > Can we to fix 46944 change the dejagnu require-linker-plugin > >> > to check if a linker plugin is used by default and not add > >> > -fuse-linker-plugin? > >> > >> That might be involved since it requires parsing gcc -Wl,-debug output. > >> I suppose the solution outlined above is simpler and thus more robust. > > > > It might be as simple as > > > > int res; > > int main() { int x; asm ("mov res, %0" : x(g)); return x; } > > > > which should fail to link with the plugin only (but yes, requies > > target dependent assembly ...). > > ... which I'd consider far too complicated/hard to maintain to consider. > > > Or, use -save-temps and check for the existence of the resolution > > file for int main() {}. It should be named t.res for gcc -o t t.c -flto. > > Only with -save-temps, otherwise it's some random file in /var/tmp. But > even so the file is removed immediately. The following seems to work for me # Return 1 if the target supports executing 750CL paired-single instructions, 0 it leaves an argument file in /tmp but otherwise nothing. Eventually scanning -v output for '-plugin' is better. > And even if we decide to fix PR lto/46944 like this, we're still left > with the problem of users invoking gcc with -fuse-linker-plugin and > getting either strange errors or no effect instead of a clear > diagnostic. Sure. But just disabling linker-plugin support for almost everyone doesn't sound like a good solution either. I'm ok with fixing 46944 somehow at this point, as well as making -fuse-linker-plugin the default only for known good linker versions. Richard. Index: gcc/testsuite/lib/target-supports.exp =================================================================== --- gcc/testsuite/lib/target-supports.exp (revision 170868) +++ gcc/testsuite/lib/target-supports.exp (working copy) @@ -1011,9 +1011,20 @@ proc check_effective_target_static_libgf } proc check_linker_plugin_available { } { - return [check_no_compiler_messages_nocache linker_plugin executable { + set result [eval check_compile { linker_plugin object { int main() { return 0; } - } "-flto -fuse-linker-plugin"] + } "-flto" } ] + set lines [lindex $result 0] + set output [lindex $result 1] + set result [gcc_target_compile $output linker_plugin[pid] executable { additional_flags=-flto additional_flags=-flto-partition=none additional_flags=-save-temps } ] + remote_file build delete $output + remote_file build delete linker_plugin[pid] + remote_file build delete linker_plugin[pid].s + if [file exists linker_plugin[pid].res] { + remote_file build delete linker_plugin[pid].res + return 1 + } + return 0 }