From patchwork Mon Sep 1 16:33:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andi Kleen X-Patchwork-Id: 384900 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 2E2C1140086 for ; Tue, 2 Sep 2014 02:35:25 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; q=dns; s=default; b=IohF3Ttn3JQ7 WvbNFBTLjZ9c0ERksTV30XKakdwOnT5wmaSPx3xXAGErcrvNKSa4fouAGmuPXvlx 4gmvam02IBPJZxGiIExOyIiWAyq43eNgpzD7eetBiPiaMMDFh9x/gQSQshdBztGF AbI9lu+ShjmiZNzGBpaH5E5+0ROpTdA= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id; s=default; bh=7xfw5NwGfQbvL0TAQK BTikUh56Q=; b=FmRJOl5iTYj55kiQEjJUH3Mov7iKNS+iSMTz593JbIgIQgq4tm cxxCkQH82R1IiAuNvkT1jndk04tkG/rw1Iy1FXXigIJsirfrcn9JVtD40kSfxx7W O1IxV6Zwe2NmeENqWWCNmvLkT1GLHLdA4DjsbosqmV4lIoOb86yRcd5TE= Received: (qmail 9437 invoked by alias); 1 Sep 2014 16:35:18 -0000 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 Received: (qmail 9413 invoked by uid 89); 1 Sep 2014 16:35:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: one.firstfloor.org Received: from one.firstfloor.org (HELO one.firstfloor.org) (193.170.194.197) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 01 Sep 2014 16:35:06 +0000 Received: from basil.firstfloor.org (184-100-237-164.ptld.qwest.net [184.100.237.164]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by one.firstfloor.org (Postfix) with ESMTPSA id 8371186A02; Mon, 1 Sep 2014 18:35:03 +0200 (CEST) Received: by basil.firstfloor.org (Postfix, from userid 1000) id 42FB2A09E7; Mon, 1 Sep 2014 09:33:58 -0700 (PDT) From: Andi Kleen To: gcc-patches@gcc.gnu.org Cc: Andi Kleen Subject: [PATCH] gcc-ar: Turn plugin not found case into a warning Date: Mon, 1 Sep 2014 09:33:45 -0700 Message-Id: <1409589225-11481-1-git-send-email-andi@firstfloor.org> From: Andi Kleen Only give a warning when gcc-ar/nm/ranlib cannot find the plugin. In this case do not pass a plugin argument to the wrapped program. This should make it work on non linker plugin systems, so that the build system can use it unconditionally. gcc/: 2014-09-01 Andi Kleen * gcc-ar (main): Only warn when plugin not found. --- gcc/gcc-ar.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c index fdff89c..e27ea3b 100644 --- a/gcc/gcc-ar.c +++ b/gcc/gcc-ar.c @@ -182,8 +182,8 @@ main (int ac, char **av) plugin = find_a_file (&target_path, LTOPLUGINSONAME, R_OK); if (!plugin) { - fprintf (stderr, "%s: Cannot find plugin '%s'\n", av[0], LTOPLUGINSONAME); - exit (1); + fprintf (stderr, "%s: Warning: Cannot find plugin '%s'\n", av[0], LTOPLUGINSONAME); + /* Fall back to not using a plugin. */ } /* Find the wrapped binutils program. */ @@ -204,15 +204,20 @@ main (int ac, char **av) } /* Create new command line with plugin */ - nargv = XCNEWVEC (const char *, ac + 4); - nargv[0] = exe_name; - nargv[1] = "--plugin"; - nargv[2] = plugin; - if (is_ar && av[1] && av[1][0] != '-') - av[1] = concat ("-", av[1], NULL); - for (k = 1; k < ac; k++) - nargv[2 + k] = av[k]; - nargv[2 + k] = NULL; + if (plugin != NULL) + { + nargv = XCNEWVEC (const char *, ac + 4); + nargv[0] = exe_name; + nargv[1] = "--plugin"; + nargv[2] = plugin; + if (is_ar && av[1] && av[1][0] != '-') + av[1] = concat ("-", av[1], NULL); + for (k = 1; k < ac; k++) + nargv[2 + k] = av[k]; + nargv[2 + k] = NULL; + } + else + nargv = CONST_CAST2 (const char **, char **, av); /* Run utility */ /* ??? the const is misplaced in pex_one's argv? */