When a major version program suffix is specified, along with
--with-gcc-major-version-only, GCC tries to install $TRIPLE-gcc-tmp into
the destination BINDIR and link it to TRIPLE-gcc-SUFFIX. However this
executable is installed in the previous step, thus leaving the gcc-tmp
unmodified.

This is because when --program-suffix=15 (any major version) and
--with-gcc-major-version-only, $(version) will be the major version
number, thus making FULL_DRIVER_NAME and GCC_TARGET_INSTALL_NAME
identical to each other. We check if these two is identical and skip the
latter step if they are.

gcc/
        PR bootstrap/105664
        * Makefile.in (install-driver): detect name collision when
        installing the driver program.

Signed-off-by: Xinhui Yang <[email protected]>
---
 gcc/Makefile.in | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 55b4cd7dbed..f998d0664d7 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -4182,7 +4182,8 @@ install-driver: installdirs xgcc$(exeext)
              $(LN) $(GCC_INSTALL_NAME)$(exeext) $(FULL_DRIVER_NAME) ); \
          fi; \
          if [ ! -f gcc-cross$(exeext) ] \
-             && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ]; 
then \
+             && [ "$(GCC_INSTALL_NAME)" != "$(GCC_TARGET_INSTALL_NAME)" ] \
+             && [ "$(GCC_TARGET_INSTALL_NAME)$(exeext)" != 
"$(FULL_DRIVER_NAME)" ] ; then \
            rm -f $(DESTDIR)$(bindir)/$(target_noncanonical)-gcc-tmp$(exeext); \
            ( cd $(DESTDIR)$(bindir) && \
              $(LN) $(GCC_INSTALL_NAME)$(exeext) 
$(target_noncanonical)-gcc-tmp$(exeext) && \
-- 
2.51.1

Reply via email to