From patchwork Sat Aug 18 21:02:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Iain Sandoe X-Patchwork-Id: 959270 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-483931-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=sandoe.co.uk Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="dQeG/wwj"; dkim-atps=neutral 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 41tCG369D3z9rvt for ; Sun, 19 Aug 2018 07:03:05 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; q=dns; s=default; b=t+0AMNevYNXAofkhRw41 2IodN59YrCzHPO3zfIQ6BwQPMalfsl235Y9b/3mu6UOGg6OqQ3CgICkz1V5nhmYA 6H1C5BRU5OYmKRGaF6BF3uZHAGXQQAeIaTpuygF7wBqUUhtM7qTjL+qK8B5DSJ35 UqZ/QhOZSCbumhQIzr1pSLM= 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 :content-type:content-transfer-encoding:mime-version:subject :message-id:date:cc:to; s=default; bh=TvurhdRr1e/NBeyZRSIuw0ewYT U=; b=dQeG/wwjKsBcXRdh5CdXhysZsapFkdAz+xt5XJ+uKS1lrZtcNBXvcwgqUt F3uoUyf9XRU/mm2PduHqvG9USWTvcCE4XFxRDo8nBL6YaomjaB7ifvYEAeFPL3mo rGCt5E+YqDpT4uOIYle8cPZ3PWkzW02e1lPZhygOFA1IWtn70= Received: (qmail 35503 invoked by alias); 18 Aug 2018 21:02:57 -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 35487 invoked by uid 89); 18 Aug 2018 21:02:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_COUK, KAM_LAZY_DOMAIN_SECURITY autolearn=ham version=3.3.2 spammy=wrappers, plug-in, Hx-spam-relays-external:ESMTPA X-HELO: smtp2.wavenetuk.net Received: from lisa.wavenetuk.net (HELO smtp2.wavenetuk.net) (195.26.37.17) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 18 Aug 2018 21:02:54 +0000 Received: from euterpe-sie.home (host81-138-1-83.in-addr.btopenworld.com [81.138.1.83]) by smtp2.wavenetuk.net (Postfix) with ESMTPA id A4544600185; Sat, 18 Aug 2018 22:02:52 +0100 (BST) From: Iain Sandoe Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: [PATCH, LTO wrappers] If we're not building a plugin don't try to invoke it. Message-Id: Date: Sat, 18 Aug 2018 22:02:49 +0100 Cc: Richard Biener To: GCC Patches Hi, The LTO wrappers are built and installed whether a plug-in is built or not. If one then tries to do --version or --help on those tools, it fails because the plugin is missing. A simple solution is not to try and invoke --plugin xxxx when we’re not building it. OK for trunk? Iain gcc/ * gcc-ar.c (main): Don’t try to invoke the plug-in if we’re not building it. --- gcc/gcc-ar.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/gcc/gcc-ar.c b/gcc/gcc-ar.c index 83a9e34b7a..82e0e69ab7 100644 --- a/gcc/gcc-ar.c +++ b/gcc/gcc-ar.c @@ -126,7 +126,9 @@ int main (int ac, char **av) { const char *exe_name; +#if HAVE_LTO_PLUGIN > 0 char *plugin; +#endif int k, status, err; const char *err_msg; const char **nargv; @@ -177,7 +179,7 @@ main (int ac, char **av) break; } - +#if HAVE_LTO_PLUGIN > 0 /* Find the GCC LTO plugin */ plugin = find_a_file (&target_path, LTOPLUGINSONAME, R_OK); if (!plugin) @@ -185,6 +187,7 @@ main (int ac, char **av) fprintf (stderr, "%s: Cannot find plugin '%s'\n", av[0], LTOPLUGINSONAME); exit (1); } +#endif /* Find the wrapped binutils program. */ exe_name = find_a_file (&target_path, PERSONALITY, X_OK); @@ -203,9 +206,11 @@ main (int ac, char **av) } } - /* Create new command line with plugin */ + /* Create new command line with plugin - if we have one, otherwise just + copy the command through. */ nargv = XCNEWVEC (const char *, ac + 4); nargv[0] = exe_name; +#if HAVE_LTO_PLUGIN > 0 nargv[1] = "--plugin"; nargv[2] = plugin; if (is_ar && av[1] && av[1][0] != '-') @@ -213,6 +218,13 @@ main (int ac, char **av) for (k = 1; k < ac; k++) nargv[2 + k] = av[k]; nargv[2 + k] = NULL; +#else + if (is_ar && av[1] && av[1][0] != '-') + av[1] = concat ("-", av[1], NULL); + for (k = 1; k < ac; k++) + nargv[k] = av[k]; + nargv[k] = NULL; +#endif /* Run utility */ /* ??? the const is misplaced in pex_one's argv? */