This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix failure to build libgcc for SH ports


The SH ports can occasionally fail to build libgcc, particularly in parallel builds:

/var/lib/jenkins/jobs/CROSS-SETUP/workspace/gcc/libgcc/unwind-dw2.c:403:10: fatal error: md-unwind-support.h: No such file or directory
 #include "md-unwind-support.h"
          ^~~~~~~~~~~~~~~~~~~~~
compilation terminated.
/var/lib/jenkins/jobs/CROSS-SETUP/workspace/gcc/libgcc/config/sh/t-sh:49: recipe for target 'unwind-dw2-Os-4-200.o' failed


The problem is the SH port defines a target to build a special version of unwind-dw2, but fails to depend on $(LIBGCC_LINKS) which sets up md-unwind-support.h and other files. So depending on the exact timing we may or may not have set up md-unwind-support.h, leading to occasional failures building libgcc.

This patch adds $(LIBGCC_LINKS) to the dependency list for the special unwind-dw2.o. That is not sufficient to fix the problem because $(LIBGCC_LINKS) is defined after the inclusion of the target makefile fragments.

So this patch also swaps inclusion of the target makefile fragment and initialization of LIBGCC_LINKS. (they were already adjacent, just in the wrong order). I did verify that none of the existing target makefile fragments append to LIBGCC_LINKS.

I think there's other missing dependencies here. But haven't done the deep analysis to be 100% sure (libgcc-tm.h in particular).



Installing on the trunk.

Jeff



diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 427328d..1dc5469 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,9 @@
+2017-04-07  Jeff Law  <law@redhat.com>
+
+	* Makefile.in: Swap definition of LIBGCC_LINKS and inclusion of
+	target makefile fragment.
+	* config/sh/t-sh (unwind-dw2-Os-4-200.o): Depend on LIBGCC_LINKS.
+
 2017-04-07  Alan Modra  <amodra@gmail.com>
 
 	PR target/45053
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index f71d320..6f58fd4 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -348,8 +348,6 @@ LIBUNWIND =
 SHLIBUNWIND_LINK =
 SHLIBUNWIND_INSTALL =
 
-tmake_file = @tmake_file@
-include $(srcdir)/empty.mk $(tmake_file)
 
 # Create links to files specified in config.host.
 LIBGCC_LINKS = enable-execute-stack.c unwind.h md-unwind-support.h \
@@ -366,6 +364,9 @@ sfp-machine.h: $(srcdir)/config/$(sfp_machine_header)
 gthr-default.h: $(srcdir)/$(thread_header)
 	-$(LN_S) $< $@
 
+tmake_file = @tmake_file@
+include $(srcdir)/empty.mk $(tmake_file)
+
 # Collect target defines and headers from config.host.
 libgcc_tm_defines = @tm_defines@
 libgcc_tm_file = @tm_file@
diff --git a/libgcc/config/sh/t-sh b/libgcc/config/sh/t-sh
index 46d01a6..10869c4 100644
--- a/libgcc/config/sh/t-sh
+++ b/libgcc/config/sh/t-sh
@@ -45,7 +45,7 @@ sdivsi3_i4i-Os-4-200.o: $(srcdir)/config/sh/lib1funcs-Os-4-200.S
 	$(gcc_compile) -c -DL_sdivsi3_i4i $<
 udivsi3_i4i-Os-4-200.o: $(srcdir)/config/sh/lib1funcs-Os-4-200.S
 	$(gcc_compile) -c -DL_udivsi3_i4i $<
-unwind-dw2-Os-4-200.o: $(srcdir)/unwind-dw2.c
+unwind-dw2-Os-4-200.o: $(srcdir)/unwind-dw2.c $(LIBGCC_LINKS)
 	$(gcc_compile) $(LIBGCC2_CFLAGS) $(vis_hide) -fexceptions -Os -c $<
 
 OBJS_Os_4_200=sdivsi3_i4i-Os-4-200.o udivsi3_i4i-Os-4-200.o unwind-dw2-Os-4-200.o

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]