This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] gcc-ar: Turn plugin not found case into a warning
- From: Richard Biener <richard dot guenther at gmail dot com>
- To: Andi Kleen <andi at firstfloor dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Andi Kleen <ak at linux dot intel dot com>
- Date: Tue, 2 Sep 2014 09:31:41 +0200
- Subject: Re: [PATCH] gcc-ar: Turn plugin not found case into a warning
- Authentication-results: sourceware.org; auth=none
- References: <1409589225-11481-1-git-send-email-andi at firstfloor dot org>
On Mon, Sep 1, 2014 at 6:33 PM, Andi Kleen <andi@firstfloor.org> wrote:
> From: Andi Kleen <ak@linux.intel.com>
>
> 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.
Hmm, maybe conditionalize the error on HAVE_LTO_PLUGIN == 2
instead? And not warn for HAVE_LTO_PLUGIN == 0 at all?
Richard.
> gcc/:
>
> 2014-09-01 Andi Kleen <ak@linux.intel.com>
>
> * 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? */
> --
> 2.1.0
>