On Thu, May 3, 2012 at 12:49 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > What gcc-ar does to find the plugin is significantly different from > what gcc driver does. This patch makes it behave tiny bit closer to > what the driver does, in particular if GCC_EXEC_PREFIX isn't defined > in the environment, it will use standard_libexec_prefix if > gcc-{ar,nm,ranlib} program lives in standard_bin_prefix directory > (in that case make_relative_prefix returns NULL), and if GCC_EXEC_PREFIX > is defined, it uses that as the directory where it expects to find > gcc-ar, rather than as the directory where to find the plugin. > > Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk/4.7?
Ok. Thanks, Richard. > 2012-05-03 Jakub Jelinek <ja...@redhat.com> > > PR plugins/53126 > * gcc-ar.c (main): If GCC_EXEC_PREFIX is set in env, > append program name to it and pass that as first argument > to make_relative_prefix. Always pass standard_libexec_prefix > as last argument to make_relative_prefix. If > make_relative_prefix returns NULL, fall back to > standard_libexec_prefix. > > --- gcc/gcc-ar.c 2011-10-31 20:44:14.000000000 +0100 > +++ gcc/gcc-ar.c 2012-05-02 21:33:45.027022291 +0200 > @@ -1,5 +1,5 @@ > /* Wrapper for ar/ranlib/nm to pass the LTO plugin. > - Copyright (C) 2011 Free Software Foundation, Inc. > + Copyright (C) 2011, 2012 Free Software Foundation, Inc. > Contributed by Andi Kleen. > > This file is part of GCC. > @@ -52,11 +52,16 @@ main(int ac, char **av) > /* XXX implement more magic from gcc.c? */ > nprefix = getenv ("GCC_EXEC_PREFIX"); > if (!nprefix) > + nprefix = av[0]; > + else > + nprefix = concat (nprefix, "gcc-" PERSONALITY, NULL); > + > + nprefix = make_relative_prefix (nprefix, > + standard_bin_prefix, > + standard_libexec_prefix); > + if (nprefix == NULL) > nprefix = standard_libexec_prefix; > > - nprefix = make_relative_prefix (av[0], > - standard_bin_prefix, > - nprefix); > plugin = concat (nprefix, > dir_separator, > DEFAULT_TARGET_MACHINE, > > Jakub