Skip to contentSkip to conversation

gcc-4.9.inc: fix parallel building failure

PATCH Superseded Hongxu Jia 2 participants 3 messages Jul 24, 2014

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover gcc-4.9.inc: fix parallel building failure

Test Steps:

1. For reproducing the issue every time, manually modify gcc/Makefile.in to delay the generation of config.h:
...

gcc/Makefile.in +3 -0
index c4daf69..c502898 100644
@@ -1622,9 +1622,12 @@ tm.h: cs-tm.h ; @true
 tm_p.h: cs-tm_p.h ; @true
 
 cs-config.h: Makefile
+   @echo "start to generate config.h `date`"
+   sleep 10
    TARGET_CPU_DEFAULT="" \
    HEADERS="$(host_xm_include_list)" DEFINES="$(host_xm_defines)" \
    $(SHELL) $(srcdir)/mkconfig.sh config.h
+   @echo "config.h generated `date`"
 
 cs-bconfig.h: Makefile
    TARGET_CPU_DEFAULT="" \

...

2. bitbake gcc-cross-arm

//Hongxu

The following changes since commit 1306f263ed7b3de4e85c6dc8b377e5c05afd6bf0:

package_ipk.bbclass: Support hierarchical feed (2014-07-23 22:06:10 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-gcc
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-gcc

Hongxu Jia (1):
gcc-4.9.inc: fix parallel building failure

 meta/recipes-devtools/gcc/gcc-4.9.inc              |  1 +
 ...Makefile.in-fix-parallel-building-failure.patch | 56 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 1/1 gcc-4.9.inc: fix parallel building failure

In subdir 'gcc', Most C source files included config.h which was generated by a rule. But no related prerequisites was added to the C source compiling rule. There was potential building failure while makefile enabled parallel.

The C source compiling rule used suffix rule '.c.o', but the suffix rule doesn't support prerequisites.
https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html

We used the pattern rule '%.o : %.c' to instead, and add the config.h as its prerequisite

We also moved the '%.o : %.c' rule down to the 'build/%.o :' rule, which makes '%.o : %.c' rule doesn't override 'build/%.o :'.

[YOCTO #6568]

---
 meta/recipes-devtools/gcc/gcc-4.9.inc              |  1 +
 ...Makefile.in-fix-parallel-building-failure.patch | 56 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
meta/recipes-devtools/gcc/gcc-4.9.inc +1 -0
index cbf1355..10bd5d5 100644
@@ -67,6 +67,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
            file://0051-eabispe.patch \
            file://0052-Fix-GCC-targeting-E500-SPE-errors-with-the-_Decimal64-type.patch \
            file://0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch \
+           file://0054-gcc-Makefile.in-fix-parallel-building-failure.patch \
 	  "
 SRC_URI[md5sum] = "9709b49ae0e904cbb0a6a1b62853b556"
 SRC_URI[sha256sum] = "b9b047a97bade9c1c89970bc8e211ff57b7b8998a1730a80a653d329f8ed1257"
meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch new file +56 -0

56 lines not on this page · raw message

Signature · 1 line
1.8.1.2
#2 lore raw
Quoted 9 lines · Hongxu Jia

In subdir 'gcc', Most C source files included config.h which was generated by a rule. But no related prerequisites was added to the C source compiling rule. There was potential building failure while makefile enabled parallel.

The C source compiling rule used suffix rule '.c.o', but the suffix rule doesn't support prerequisites.
https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html

Quoted 7 lines

We used the pattern rule '%.o : %.c' to instead, and add the config.h as its prerequisite

We also moved the '%.o : %.c' rule down to the 'build/%.o :' rule, which makes '%.o : %.c' rule doesn't override 'build/%.o :'.

[YOCTO #6568]

Please post this patch to gcc mailing list as well for feedback.

Quoted 90 lines
---
 meta/recipes-devtools/gcc/gcc-4.9.inc              |  1 +
 ...Makefile.in-fix-parallel-building-failure.patch | 56 ++++++++++++++++++++++
 2 files changed, 57 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch
meta/recipes-devtools/gcc/gcc-4.9.inc +1 -0
index cbf1355..10bd5d5 100644
@@ -67,6 +67,7 @@ SRC_URI = "${GNU_MIRROR}/gcc/gcc-${PV}/gcc-${PV}.tar.bz2 \
            file://0051-eabispe.patch \
            file://0052-Fix-GCC-targeting-E500-SPE-errors-with-the-_Decimal64-type.patch \
            file://0053-gcc-fix-segfault-from-calling-free-on-non-malloc-d-a.patch \
+           file://0054-gcc-Makefile.in-fix-parallel-building-failure.patch \
          "
 SRC_URI[md5sum] = "9709b49ae0e904cbb0a6a1b62853b556"
 SRC_URI[sha256sum] = "b9b047a97bade9c1c89970bc8e211ff57b7b8998a1730a80a653d329f8ed1257"
meta/recipes-devtools/gcc/gcc-4.9/0054-gcc-Makefile.in-fix-parallel-building-failure.patch new file +56 -1
new file mode 100644
index 0000000..213820a
@@ -0,0 +1,56 @@
+gcc/Makefile.in: fix parallel building failure
+
+Most C source files included config.h which was generated by a rule.
+But no related prerequisites was added to the C source compiling rule.
+There was potential building failure while makefile enabled parallel.
+
+The C source compiling rule used suffix rule '.c.o', but the suffix
+rule doesn't support prerequisites.
+https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html
+
+We used the pattern rule '%.o : %.c' to instead, and add the config.h
+as its prerequisite
+
+We also moved the '%.o : %.c' rule down to the 'build/%.o :' rule, which
+makes '%.o : %.c' rule doesn't override 'build/%.o :'.
+
+Upstream-Status: Pending
+
+Signed-off-by: Hongxu Jia <[email protected]>
+---
+ gcc/Makefile.in | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/gcc/Makefile.in b/gcc/Makefile.in
+index 6475cba..04889fe 100644
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -1054,10 +1054,6 @@ COMPILE = source='$<' object='$@' libtool=no \
+ POSTCOMPILE =
+ endif
+
+-.cc.o .c.o:
+-      $(COMPILE) $<
+-      $(POSTCOMPILE)
+-
+ #
+ # Support for additional languages (other than C).
+ # C can be supported this way too (leave for later).
+@@ -2342,6 +2338,14 @@ build/%.o :  # dependencies provided by explicit rule later
+       $(COMPILER_FOR_BUILD) -c $(BUILD_COMPILERFLAGS) $(BUILD_CPPFLAGS) \
+               -o $@ $<
+
++%.o: %.c $(CONFIG_H)
++      $(COMPILE) $<
++      $(POSTCOMPILE)
++
++%.o: %.cc $(CONFIG_H)
++      $(COMPILE) $<
++      $(POSTCOMPILE)
++
+ ## build/version.o is compiled by the $(COMPILER_FOR_BUILD) but needs
+ ## several C macro definitions, just like version.o
+ build/version.o:  version.c version.h \
+--
+1.8.1.2
+
--

1.8.1.2

--
_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-core