https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105664

--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Francois-Xavier Coudert from comment #7)
> So, to summarise my understanding:
> 
> - the problem is not specific to darwin, I can fully reproduce on
> x86_64-linux-gnu
> 
> - the problem only arises if you configure with a --program-suffix that is
> equal to the version. Then $(target_noncanonical)-gcc-$(version) is equal to
> $(GCC_TARGET_INSTALL_NAME) and this triggers the issue.
> 
> 
> I am not sure if it is the cleanest way to fix things, but I think we can
> safely remove the temporary file after "mv", in all cases, like this:
> 
> 
> diff --git a/gcc/Makefile.in b/gcc/Makefile.in
> index 97e5450ecb5..602c382e86e 100644
> --- a/gcc/Makefile.in
> +++ b/gcc/Makefile.in
> @@ -3780,6 +3780,7 @@ install-driver: installdirs xgcc$(exeext)
>             ( cd $(DESTDIR)$(bindir) && \
>               $(LN) $(GCC_INSTALL_NAME)$(exeext)
> $(target_noncanonical)-gcc-tmp$(exeext) && \
>               mv -f $(target_noncanonical)-gcc-tmp$(exeext)
> $(GCC_TARGET_INSTALL_NAME)$(exeext) ); \
> +           rm -f
> $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
>           fi; \
>         fi
>  
> 
> I can confirm this fixes the issue.

Testing whether $(GCC_TARGET_INSTALL_NAME)$(exeext) is present before
creating the link might also work?  Or testing whether it is the same
as $(target_noncanonical)-gcc-$(version)?

Reply via email to