http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53126
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-05-02 19:39:11 UTC --- Created attachment 27290 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27290 gcc48-pr53126.patch Ugh, what gcc-ar does isn't even remotely matching to what gcc does. If GCC_EXEC_PREFIX isn't in the environment, then it will gcc_libexec_prefix = get_relative_prefix (decoded_options[0].arg, standard_bindir_prefix, standard_libexec_prefix); and when it is there, it will: /* make_relative_prefix requires a program name, but GCC_EXEC_PREFIX is typically a directory name with a trailing / (which is ignored by make_relative_prefix), so append a program name. */ char *tmp_prefix = concat (gcc_exec_prefix, "gcc", NULL); gcc_libexec_prefix = get_relative_prefix (tmp_prefix, standard_exec_prefix, standard_libexec_prefix); /* The path is unrelocated, so fallback to the original setting. */ if (!gcc_libexec_prefix) gcc_libexec_prefix = standard_libexec_prefix; Even if GCC_EXEC_PREFIX isn't in the environment, and gcc_libexec_prefix is NULL after this, we end up doing /* If we don't know where the toolchain has been installed, use the configured-in locations. */ if (!gcc_exec_prefix) { #ifndef OS2 add_prefix (&exec_prefixes, standard_libexec_prefix, "GCC", PREFIX_PRIORITY_LAST, 1, 0); add_prefix (&exec_prefixes, standard_libexec_prefix, "BINUTILS", PREFIX_PRIORITY_LAST, 2, 0); ... so I'd say what this patch does brings it at least a little bit closer to what gcc driver does. Having make_relative_prefix return NULL is actually the common case where the compiler is installed where it has been configured.