On Thu, Feb 19, 2026 at 07:44:19AM +0100, Jakub Jelinek wrote:
> In the past few bootstraps/regtests, I got occassionally one random FAIL
> in libgomp testsuite, and the log said in each of the cases something like
> obj02/x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.log:/usr/bin/ld: error: 
> /home/jakub/src/gcc/obj02/gcc/libatomic.so: file too short
> obj02/x86_64-pc-linux-gnu/libgomp/testsuite/libgomp.log:/usr/bin/ld: error: 
> /home/jakub/src/gcc/obj02/gcc/libatomic.so: file too short
> obj05/i686-pc-linux-gnu/libgomp/testsuite/libgomp.log:/home/jakub/src/gcc/obj05/gcc/libatomic.so:
>  file not recognized: file format not recognized
> obj05/i686-pc-linux-gnu/libgomp/testsuite/libgomp.log:/home/jakub/src/gcc/obj05/gcc/libatomic.so:
>  file not recognized: file format not recognized

On a second thought, the problem is that all-local is a .PHONY target,
so it is remade all the time because it doesn't exist.  It already
depends on libatomic.la.  So, the following patch instead
makes all-local depend on stmp-libatomic, which is a file touched
after we install the files, so it will be reinvoked only when stmp-libatomic
is older than libatomic.la or when it doesn't exist.

How does this look?

So far tested by make all-target-libatomic and reruning make in the
libatomic directory to see that it doesn't rerun the installation.

2026-02-18  Jakub Jelinek  <[email protected]>

        * Makefile.am (all-local): Depend on stmp-libatomic and otherwise
        do nothing.
        (stmp-libatomic): New goal, move all commands from all-local here plus
        touch $@ at the end.
        * Makefile.in: Regenerate.

--- libatomic/Makefile.am.jj    2026-02-19 08:19:27.312619589 +0100
+++ libatomic/Makefile.am       2026-02-19 18:03:25.379866161 +0100
@@ -181,7 +181,8 @@ all-multi: $(libatomic_la_LIBADD)
 # from $gcc_objdir seems to fix the issue.
 
 gcc_objdir = `pwd`/$(MULTIBUILDTOP)../../gcc/
-all-local: libatomic.la
+all-local: stmp-libatomic
+stmp-libatomic: libatomic.la
        $(LIBTOOL) --mode=install $(INSTALL_DATA) libatomic.la 
$(gcc_objdir)$(MULTISUBDIR)/
 if LIBAT_BUILD_ASNEEDED_SOLINK
        cd $(gcc_objdir)$(MULTISUBDIR) || exit 1; \
@@ -193,6 +194,7 @@ if LIBAT_BUILD_ASNEEDED_SOLINK
        $(LN_S) libatomic.a libatomic_asneeded.a; fi
 endif
        rm $(gcc_objdir)$(MULTISUBDIR)/libatomic.la
+       touch $@
 
 if LIBAT_BUILD_ASNEEDED_SOLINK
 install-data-am: install-asneeded
--- libatomic/Makefile.in.jj    2026-02-19 08:19:27.312619589 +0100
+++ libatomic/Makefile.in       2026-02-19 18:05:06.865571288 +0100
@@ -929,7 +929,8 @@ vpath % $(strip $(search_path))
 # makefile fragments to avoid broken *.Ppo getting included into the Makefile
 # when it is reloaded during the build of all-multi.
 all-multi: $(libatomic_la_LIBADD)
-all-local: libatomic.la
+all-local: stmp-libatomic
+stmp-libatomic: libatomic.la
        $(LIBTOOL) --mode=install $(INSTALL_DATA) libatomic.la 
$(gcc_objdir)$(MULTISUBDIR)/
 @LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@     cd $(gcc_objdir)$(MULTISUBDIR) || exit 
1; \
 @LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@     if test -f libatomic.so; then (echo "/* 
GNU ld script"; \
@@ -939,6 +940,7 @@ all-local: libatomic.la
 @LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@     if test -f libatomic.a; then rm -f 
libatomic_asneeded.a; \
 @LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@     $(LN_S) libatomic.a 
libatomic_asneeded.a; fi
        rm $(gcc_objdir)$(MULTISUBDIR)/libatomic.la
+       touch $@
 
 @LIBAT_BUILD_ASNEEDED_SOLINK_TRUE@install-data-am: install-asneeded
 


        Jakub

Reply via email to