PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

classic Classic list List threaded Threaded
23 messages Options
12
Reply | Threaded
Open this post in threaded view
|

PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

H.J. Lu
Hi,

Any objection to this patch?

Thanks.


H.J.
---
2010-12-02  H.J. Lu  <[hidden email]>

        PR binutils/12283
        * doc/Makefile.am: Add proper dependency on $(MKDOC).
        * doc/Makefile.in: Regenerated.

diff --git a/bfd/doc/Makefile.am b/bfd/doc/Makefile.am
index 201273b..6060bb1 100644
--- a/bfd/doc/Makefile.am
+++ b/bfd/doc/Makefile.am
@@ -72,120 +72,93 @@ protos: libbfd.h libcoff.h bfd.h
 # We can't replace these rules with an implicit rule, because
 # makes without VPATH support couldn't find the .h files in `..'.
 
-# We do not depend on chew directly so that we can distribute the info
-# files, and permit people to rebuild them, without requiring the makeinfo
-# program.  If somebody tries to rebuild info, but none of the .texi files
-# have changed, then nothing will be rebuilt.
-
-aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+aoutx.texi: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
  $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
 
-archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+archive.texi: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp
  $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi
 
-archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+archures.texi: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp
  $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi
 
 # We use bfdt.texi, rather than bfd.texi, to avoid conflicting with
 # bfd.texinfo on an 8.3 filesystem.
-bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdt.texi: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
 
-cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+cache.texi: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp
  $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi
 
-coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+coffcode.texi: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp
  $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
 
-core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+core.texi: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp
  $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi
 
-elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+elf.texi: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp
  $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi
 
-elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+elfcode.texi: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp
  $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
 
-mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+mmo.texi: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
  $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi
 
-format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+format.texi: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
  $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi
 
-libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+libbfd.texi: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp
  $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
 
-bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdio.texi: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
 
-bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdwin.texi: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
 
-opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+opncls.texi: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str  <$(srcdir)/../opncls.c >opncls.tmp
  $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi
 
-reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+reloc.texi: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp
  $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi
 
-section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+section.texi: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp
  $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi
 
-syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+syms.texi: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp
  $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi
 
-targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+targets.texi: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp
  $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi
 
-init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+init.texi: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp
  $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi
 
-hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+hash.texi: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp
  $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi
 
-linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+linker.texi: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp
  $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi
 
diff --git a/bfd/doc/Makefile.in b/bfd/doc/Makefile.in
index cce9422..c575f8e 100644
--- a/bfd/doc/Makefile.in
+++ b/bfd/doc/Makefile.in
@@ -770,120 +770,93 @@ protos: libbfd.h libcoff.h bfd.h
 # We can't replace these rules with an implicit rule, because
 # makes without VPATH support couldn't find the .h files in `..'.
 
-# We do not depend on chew directly so that we can distribute the info
-# files, and permit people to rebuild them, without requiring the makeinfo
-# program.  If somebody tries to rebuild info, but none of the .texi files
-# have changed, then nothing will be rebuilt.
-
-aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+aoutx.texi: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
  $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
 
-archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+archive.texi: $(MKDOC) $(srcdir)/../archive.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp
  $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi
 
-archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+archures.texi: $(MKDOC) $(srcdir)/../archures.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp
  $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi
 
 # We use bfdt.texi, rather than bfd.texi, to avoid conflicting with
 # bfd.texinfo on an 8.3 filesystem.
-bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdt.texi: $(MKDOC) $(srcdir)/../bfd.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
 
-cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+cache.texi: $(MKDOC) $(srcdir)/../cache.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp
  $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi
 
-coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+coffcode.texi: $(MKDOC) $(srcdir)/../coffcode.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp
  $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
 
-core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+core.texi: $(MKDOC) $(srcdir)/../corefile.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp
  $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi
 
-elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+elf.texi: $(MKDOC) $(srcdir)/../elf.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp
  $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi
 
-elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+elfcode.texi: $(MKDOC) $(srcdir)/../elfcode.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp
  $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
 
-mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+mmo.texi: $(MKDOC) $(srcdir)/../mmo.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
  $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi
 
-format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+format.texi: $(MKDOC) $(srcdir)/../format.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
  $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi
 
-libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+libbfd.texi: $(MKDOC) $(srcdir)/../libbfd.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp
  $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
 
-bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdio.texi: $(MKDOC) $(srcdir)/../bfdio.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
 
-bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdwin.texi: $(MKDOC) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
 
-opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+opncls.texi: $(MKDOC) $(srcdir)/../opncls.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str  <$(srcdir)/../opncls.c >opncls.tmp
  $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi
 
-reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+reloc.texi: $(MKDOC) $(srcdir)/../reloc.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp
  $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi
 
-section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+section.texi: $(MKDOC) $(srcdir)/../section.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp
  $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi
 
-syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+syms.texi: $(MKDOC) $(srcdir)/../syms.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp
  $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi
 
-targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+targets.texi: $(MKDOC) $(srcdir)/../targets.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp
  $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi
 
-init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+init.texi: $(MKDOC) $(srcdir)/../init.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp
  $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi
 
-hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+hash.texi: $(MKDOC) $(srcdir)/../hash.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp
  $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi
 
-linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+linker.texi: $(MKDOC) $(srcdir)/../linker.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp
  $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi
 
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
Hello H.J.,

* H.J. Lu wrote on Thu, Dec 02, 2010 at 06:00:32PM CET:
> Any objection to this patch?

The rule to update $(MKDOC):

$(MKDOC): $(srcdir)/chew.c
        $(CC_FOR_BUILD) -o chew.$$$$ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
          $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
        $(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)

should be atomic (the ';' should be '&&' though).  So, I would be
interested to see the last 100 or so lines of a failure happening,
because I can't spot one nor reproduce it.  Also, configure flags.

Thanks,
Ralf

> 2010-12-02  H.J. Lu  <[hidden email]>
>
> PR binutils/12283
> * doc/Makefile.am: Add proper dependency on $(MKDOC).
> * doc/Makefile.in: Regenerated.

> --- a/bfd/doc/Makefile.am
> +++ b/bfd/doc/Makefile.am
> @@ -72,120 +72,93 @@ protos: libbfd.h libcoff.h bfd.h
>  # We can't replace these rules with an implicit rule, because
>  # makes without VPATH support couldn't find the .h files in `..'.
>  
> -# We do not depend on chew directly so that we can distribute the info
> -# files, and permit people to rebuild them, without requiring the makeinfo
> -# program.  If somebody tries to rebuild info, but none of the .texi files
> -# have changed, then nothing will be rebuilt.
> -
> -aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
> - $(MAKE) $(MKDOC)
> +aoutx.texi: $(MKDOC) $(srcdir)/../aoutx.h $(srcdir)/doc.str
>   ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
>   $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
[...]
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

H.J. Lu-30
On Thu, Dec 2, 2010 at 10:08 AM, Ralf Wildenhues <[hidden email]> wrote:

> Hello H.J.,
>
> * H.J. Lu wrote on Thu, Dec 02, 2010 at 06:00:32PM CET:
>> Any objection to this patch?
>
> The rule to update $(MKDOC):
>
> $(MKDOC): $(srcdir)/chew.c
>        $(CC_FOR_BUILD) -o chew.$$$$ $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) \
>          $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
>        $(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
>
> should be atomic (the ';' should be '&&' though).  So, I would be

Failure is very random. There is a race condition. "make -j8" on a 16core
machine can start making $(MKDOC) at the same time. How can move-if-change
be 100% atomic?

> interested to see the last 100 or so lines of a failure happening,
> because I can't spot one nor reproduce it.  Also, configure flags.
>

--
H.J.
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
* H.J. Lu wrote on Thu, Dec 02, 2010 at 07:16:07PM CET:
> On Thu, Dec 2, 2010 at 10:08 AM, Ralf Wildenhues wrote:
> > * H.J. Lu wrote on Thu, Dec 02, 2010 at 06:00:32PM CET:
> >> Any objection to this patch?
> >
> > The rule to update $(MKDOC):

> > should be atomic (the ';' should be '&&' though).  So, I would be
>
> Failure is very random. There is a race condition. "make -j8" on a 16core
> machine can start making $(MKDOC) at the same time. How can move-if-change
> be 100% atomic?

Well, 'mv -f' within a mount point is atomic, that's how.  Show the
failure when you next see one, please.  Also, which make version?

We could move to the PR for gathering data?

Thanks,
Ralf
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
* Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:20:50PM CET:
> * H.J. Lu wrote on Thu, Dec 02, 2010 at 07:16:07PM CET:
> > Failure is very random. There is a race condition. "make -j8" on a 16core
> > machine can start making $(MKDOC) at the same time. How can move-if-change
> > be 100% atomic?
>
> Well, 'mv -f' within a mount point is atomic, that's how.

Ahh, move-if-change is broken: it doesn't ignore mv -f failure when the
target is equal.  Let's fix move-if-change.

Cheers,
Ralf
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
* Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:22:35PM CET:

> * Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:20:50PM CET:
> > * H.J. Lu wrote on Thu, Dec 02, 2010 at 07:16:07PM CET:
> > > Failure is very random. There is a race condition. "make -j8" on a 16core
> > > machine can start making $(MKDOC) at the same time. How can move-if-change
> > > be 100% atomic?
> >
> > Well, 'mv -f' within a mount point is atomic, that's how.
>
> Ahh, move-if-change is broken: it doesn't ignore mv -f failure when the
> target is equal.  Let's fix move-if-change.

Does this alternative (untested) patch fix the race?

Thanks,
Ralf

ChangeLog:
2010-12-02  Ralf Wildenhues  <[hidden email]>

        PR binutils/12283
        * move-if-change: Ignore failure of 'mv -f' if the destination
        is equal to the source afterwards.

diff --git a/move-if-change b/move-if-change
index ff74a55..1d2dd09 100755
--- a/move-if-change
+++ b/move-if-change
@@ -4,6 +4,8 @@
 
 usage="$0: usage: $0 SOURCE DEST"
 
+cmpprog=${CMPPROG-cmp}
+
 case $# in
 2) ;;
 *) echo "$usage" >&2; exit 1;;
@@ -18,5 +20,8 @@ done
 if test -r "$2" && cmp -s "$1" "$2"; then
   rm -f "$1"
 else
-  mv -f "$1" "$2"
+  if mv -f "$1" "$2"; then :; else
+    # Ignore failure due to a concurrent move-if-change.
+    $cmpprog "$1" "$2" >/dev/null 2>&1
+  fi
 fi
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

H.J. Lu-30
On Thu, Dec 2, 2010 at 10:32 AM, Ralf Wildenhues <[hidden email]> wrote:

> * Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:22:35PM CET:
>> * Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:20:50PM CET:
>> > * H.J. Lu wrote on Thu, Dec 02, 2010 at 07:16:07PM CET:
>> > > Failure is very random. There is a race condition. "make -j8" on a 16core
>> > > machine can start making $(MKDOC) at the same time. How can move-if-change
>> > > be 100% atomic?
>> >
>> > Well, 'mv -f' within a mount point is atomic, that's how.
>>
>> Ahh, move-if-change is broken: it doesn't ignore mv -f failure when the
>> target is equal.  Let's fix move-if-change.
>
> Does this alternative (untested) patch fix the race?
>
> Thanks,
> Ralf
>
> ChangeLog:
> 2010-12-02  Ralf Wildenhues  <[hidden email]>
>
>        PR binutils/12283
>        * move-if-change: Ignore failure of 'mv -f' if the destination
>        is equal to the source afterwards.
>
> diff --git a/move-if-change b/move-if-change
> index ff74a55..1d2dd09 100755
> --- a/move-if-change
> +++ b/move-if-change
> @@ -4,6 +4,8 @@
>
>  usage="$0: usage: $0 SOURCE DEST"
>
> +cmpprog=${CMPPROG-cmp}
> +
>  case $# in
>  2) ;;
>  *) echo "$usage" >&2; exit 1;;
> @@ -18,5 +20,8 @@ done
>  if test -r "$2" && cmp -s "$1" "$2"; then
>   rm -f "$1"
>  else
> -  mv -f "$1" "$2"
> +  if mv -f "$1" "$2"; then :; else
> +    # Ignore failure due to a concurrent move-if-change.
> +    $cmpprog "$1" "$2" >/dev/null 2>&1
> +  fi
>  fi
>

It is hard to test since it happens very much at random.


--
H.J.
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
* H.J. Lu wrote on Thu, Dec 02, 2010 at 07:39:53PM CET:
> On Thu, Dec 2, 2010 at 10:32 AM, Ralf Wildenhues wrote:
> >
> > Does this alternative (untested) patch fix the race?
>
> It is hard to test since it happens very much at random.

If

  cd bfd/doc
  while make clean && make -j8 all; do :; done

without the patch exposes the bug, then it should verify the bug is
fixed with the patch.  You might have to rm more files for cleaning
and/or add 'info' or so to the 'all' target, but the above should do
dozens or tries per minute so give a fairly reliable answer after an
hour or so.

Thanks,
Ralf
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
In reply to this post by Ralf Wildenhues
* Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:32:31PM CET:
> > > * H.J. Lu wrote on Thu, Dec 02, 2010 at 07:16:07PM CET:
> > > > Failure is very random. There is a race condition. "make -j8" on a 16core
> > > > machine can start making $(MKDOC) at the same time. How can move-if-change
> > > > be 100% atomic?

> > Ahh, move-if-change is broken: it doesn't ignore mv -f failure when the
> > target is equal.  Let's fix move-if-change.
>
> Does this alternative (untested) patch fix the race?

Have you had a chance to try this out?

Thanks,
Ralf

> ChangeLog:
> 2010-12-02  Ralf Wildenhues  <[hidden email]>
>
> PR binutils/12283
> * move-if-change: Ignore failure of 'mv -f' if the destination
> is equal to the source afterwards.
>
> diff --git a/move-if-change b/move-if-change
> index ff74a55..1d2dd09 100755
> --- a/move-if-change
> +++ b/move-if-change
> @@ -4,6 +4,8 @@
>  
>  usage="$0: usage: $0 SOURCE DEST"
>  
> +cmpprog=${CMPPROG-cmp}
> +
>  case $# in
>  2) ;;
>  *) echo "$usage" >&2; exit 1;;
> @@ -18,5 +20,8 @@ done
>  if test -r "$2" && cmp -s "$1" "$2"; then
>    rm -f "$1"
>  else
> -  mv -f "$1" "$2"
> +  if mv -f "$1" "$2"; then :; else
> +    # Ignore failure due to a concurrent move-if-change.
> +    $cmpprog "$1" "$2" >/dev/null 2>&1
> +  fi
>  fi
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

H.J. Lu-30
On Sun, Dec 19, 2010 at 6:30 AM, Ralf Wildenhues <[hidden email]> wrote:

> * Ralf Wildenhues wrote on Thu, Dec 02, 2010 at 07:32:31PM CET:
>> > > * H.J. Lu wrote on Thu, Dec 02, 2010 at 07:16:07PM CET:
>> > > > Failure is very random. There is a race condition. "make -j8" on a 16core
>> > > > machine can start making $(MKDOC) at the same time. How can move-if-change
>> > > > be 100% atomic?
>
>> > Ahh, move-if-change is broken: it doesn't ignore mv -f failure when the
>> > target is equal.  Let's fix move-if-change.
>>
>> Does this alternative (untested) patch fix the race?
>
> Have you had a chance to try this out?

It doesn't fail. But I couldn't reproduce the old problem anymore.


H.J.

> Thanks,
> Ralf
>
>> ChangeLog:
>> 2010-12-02  Ralf Wildenhues  <[hidden email]>
>>
>>       PR binutils/12283
>>       * move-if-change: Ignore failure of 'mv -f' if the destination
>>       is equal to the source afterwards.
>>
>> diff --git a/move-if-change b/move-if-change
>> index ff74a55..1d2dd09 100755
>> --- a/move-if-change
>> +++ b/move-if-change
>> @@ -4,6 +4,8 @@
>>
>>  usage="$0: usage: $0 SOURCE DEST"
>>
>> +cmpprog=${CMPPROG-cmp}
>> +
>>  case $# in
>>  2) ;;
>>  *) echo "$usage" >&2; exit 1;;
>> @@ -18,5 +20,8 @@ done
>>  if test -r "$2" && cmp -s "$1" "$2"; then
>>    rm -f "$1"
>>  else
>> -  mv -f "$1" "$2"
>> +  if mv -f "$1" "$2"; then :; else
>> +    # Ignore failure due to a concurrent move-if-change.
>> +    $cmpprog "$1" "$2" >/dev/null 2>&1
>> +  fi
>>  fi
>



--
H.J.
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Steve Ellcey
I tried this patch and I think it works.  Before patching I got:

mv: cannot move `chew.13844' to `chew': Text file busy
make[3]: *** [chew] Error 1
make[2]: *** [bfdt.texi] Error 2
make[2]: *** Waiting for unfinished jobs....
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [info-recursive] Error 1
make: *** [all-bfd] Error 2

After applying the patch and doing some builds, I still got the mv
error message about 'cannot move' but the make did not fail.  Perhaps
we should change move-if-needed to send the stderr of the mv -f to
/dev/null like we do with cmpprog.

Steve Ellcey
[hidden email]
Reply | Threaded
Open this post in threaded view
|

PATCH: import move-if-change from gnulib (was: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build)

Ralf Wildenhues
[ adding gcc-patches ]

* Steve Ellcey wrote on Fri, Jan 28, 2011 at 12:57:25AM CET:

> I tried this patch and I think it works.  Before patching I got:
>
> mv: cannot move `chew.13844' to `chew': Text file busy
> make[3]: *** [chew] Error 1
> make[2]: *** [bfdt.texi] Error 2
> make[2]: *** Waiting for unfinished jobs....
> make[2]: *** Waiting for unfinished jobs....
> make[1]: *** [info-recursive] Error 1
> make: *** [all-bfd] Error 2
>
> After applying the patch and doing some builds, I still got the mv
> error message about 'cannot move' but the make did not fail.

Thank you for confirming this.

> Perhaps we should change move-if-needed to send the stderr of the mv
> -f to /dev/null like we do with cmpprog.

I don't think that it is generally useful to hide the error output:
in case of a full disk or a real write error, the message can provide
valuable help in diagnosing the cause.  It can otherwise be very tricky
to analyze parallel build failures.

I have meanwhile added an improved and fixed version of my proposed
patch to the (more complete) gnulib copy of move-if-change.  See here:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24860/focus=24865

I hereby propose to just import the gnulib copy into GCC and src,
http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/move-if-change
and document the change in status as below in patches to src/MAINTAINERS
and GCC www.  (The Autoconf copy of move-if-change has been updated from
the gnulib one anyway.)

Any reasons against doing so?

Thanks,
Ralf

ChangeLog:
2011-01-28  Ralf Wildenhues  <[hidden email]>

        * MAINTAINERS (mkinstalldirs): Comes from Automake.
        (move-if-change): Comes from gnulib.

diff --git a/MAINTAINERS b/MAINTAINERS
index a471c90..046c5ea 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -38,7 +38,7 @@ config.guess; config.sub; readline/support/config.{sub,guess}
  [hidden email]
  [hidden email]
 
-depcomp
+depcomp; mkinstalldirs
         Send bug reports and patches to [hidden email].
 
 gdb/; readline/; sim/; GDB's part of include/
@@ -69,12 +69,8 @@ ltconfig; ltmain.sh; ltcf-*.sh
  sources or submitted to the master file maintainer and brought
  in via a merge.
 
-mkinstalldirs; move-if-change
- autoconf: http://gnu.org
- Patches to [hidden email].
- Changes need to be done in tandem with the official AUTOCONF
- sources or submitted to the master file maintainer and brought
- in via a merge.
+move-if-change
+ Send bug reports and patches to [hidden email].
 
 symlink-tree
  gcc: http://gcc.gnu.org




Index: codingconventions.html
===================================================================
RCS file: /cvs/gcc/wwwdocs/htdocs/codingconventions.html,v
retrieving revision 1.62
diff -u -r1.62 codingconventions.html
--- codingconventions.html 8 Jan 2011 12:12:42 -0000 1.62
+++ codingconventions.html 28 Jan 2011 20:13:41 -0000
@@ -490,6 +490,11 @@
 symlink-tree and ylwrap:  These are copied from mainline automake, using
 <code>automake --add-missing --copy --force-missing</code>.</li>
 
+<li>move-if-change:  gnulib hosts this now.  The latest version can be
+retrieved from
+<a href="http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/move-if-change">http://git.savannah.gnu.org/cgit/gnulib.git/plain/build-aux/move-if-change</a>.
+</li>
+
 <li>Top-level config.rpath:  This comes originally from gettext, but
 gnulib can be considered upstream.  The latest version can be retrieved
 from
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: import move-if-change from gnulib (was: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build)

Steve Ellcey
On Fri, 2011-01-28 at 21:14 +0100, Ralf Wildenhues wrote:

>
> I have meanwhile added an improved and fixed version of my proposed
> patch to the (more complete) gnulib copy of move-if-change.  See here:
> http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/24860/focus=24865
>
> I hereby propose to just import the gnulib copy into GCC and src,
> http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/move-if-change
> and document the change in status as below in patches to src/MAINTAINERS
> and GCC www.  (The Autoconf copy of move-if-change has been updated from
> the gnulib one anyway.)
>
> Any reasons against doing so?
>
> Thanks,
> Ralf

I have no objection to this change and I think it will fix things on
most platforms but I have found one platform where I still have a
problem.  On hppa*-*-hpux*, compiling the same program twice in a row
does not result in the exact same executable.  So even with this change
the cmp will fail and the build will still abort like it does now.
During a GCC bootstrap build we work around these issues by using:

cmp --ignore-initial=16

to compare stage2 and stage3 bits.  And we also have to do the GCC
compilation with -frandom-seed=fixed-seed to avoid other differences in
object files.

But for some reason doing both of these still didn't get this to work
for me on the hppa platform.  I was still getting failures in the cmp
check, even with the --ignore-initial flag and the use of -frandom-seed
when compiling chew.

I wonder if it would be reasonable to add a configure flag to bfd that
would enforce the chew dependency (--enable-parallel-doc or something
like that).  It would be off by default but if specified then we would
enforce the chew dependency and parallel builds would just work
normally.

Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Steve Ellcey
In reply to this post by H.J. Lu-30
This patch is intended to be a secondary fix/workaround for the problem
that can happen when building bfd/doc using a parallel make.   Ralf
Wildenhues has a fix to move-if-changed that should fix the problem for
any target where compiling a file multiple times will always result in
exactly the same binary, but I have at least one platform where this is
not the case: hppa*-*-hpux*.  So I would also like to have this fix as a
backup to Ralf's patch (which I think should also go in).

This patch does not change the default make behaviour but allows a user
to specify '--enable-parallel-doc' during the bfd configure so that a
parallel build works correctly.  Using this argument would make the
*.texi targets dependent on chew instead of chew.c and allow parallel
builds to work (because chew would only be built once).  This means the
user will need to have makeinfo on their system but I think that is
reasonable since it only affects users of the new option.

I have tested this on hppa2.0w-hp-hpux11.11 to verify that I still get
the failure without using this option and that I don't get it (and that
chew is only built once) when I do use the new option.

OK to checkin?

Steve Ellcey
[hidden email]


2011-01-28  Steve Ellcey  <[hidden email]>

        PR binutils/12283
        * configure.in: Add --enable-parallel-doc flag.
        * configure: Regenerate.
        * doc/Makefile.am: Add CHEW_DEP variable.
        * doc/Makefile.in: Regenerate.


Index: configure.in
===================================================================
RCS file: /cvs/src/src/bfd/configure.in,v
retrieving revision 1.290
diff -r1.290 configure.in
112a113,123

> # Check to see if we should allow parallel doc make
> AC_ARG_ENABLE(parallel-doc,
> [  --enable-parallel-doc    Allow parallel build of doc directory],
> [case "${enableval}" in
>   yes) want_pdoc=true ;;
>   no)  want_pdoc=false ;;
>   *)   AC_MSG_ERROR(bad value ${enableval} for parallel-doc option) ;;
>  esac],[want_pdoc=false])dnl
>
> AM_CONDITIONAL(PARALLEL_DOC, test "$want_pdoc" = "true")
>
Index: doc/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/doc/Makefile.am,v
retrieving revision 1.28
diff -r1.28 Makefile.am
61a62,67
> if PARALLEL_DOC
> CHEW_DEP = $(MKDOC)
> else
> CHEW_DEP = chew.c
> endif
>
77c83
< aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
---
> aoutx.texi: $(CHEW_DEP) $(srcdir)/../aoutx.h $(srcdir)/doc.str
82c88
< archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
---
> archive.texi: $(CHEW_DEP) $(srcdir)/../archive.c $(srcdir)/doc.str
87c93
< archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
---
> archures.texi: $(CHEW_DEP) $(srcdir)/../archures.c $(srcdir)/doc.str
94c100
< bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
---
> bfdt.texi: $(CHEW_DEP) $(srcdir)/../bfd.c $(srcdir)/doc.str
99c105
< cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
---
> cache.texi: $(CHEW_DEP) $(srcdir)/../cache.c $(srcdir)/doc.str
104c110
< coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
---
> coffcode.texi: $(CHEW_DEP) $(srcdir)/../coffcode.h $(srcdir)/doc.str
109c115
< core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
---
> core.texi: $(CHEW_DEP) $(srcdir)/../corefile.c $(srcdir)/doc.str
114c120
< elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
---
> elf.texi: $(CHEW_DEP) $(srcdir)/../elf.c $(srcdir)/doc.str
119c125
< elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
---
> elfcode.texi: $(CHEW_DEP) $(srcdir)/../elfcode.h $(srcdir)/doc.str
124c130
< mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
---
> mmo.texi: $(CHEW_DEP) $(srcdir)/../mmo.c $(srcdir)/doc.str
129c135
< format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
---
> format.texi: $(CHEW_DEP) $(srcdir)/../format.c $(srcdir)/doc.str
134c140
< libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
---
> libbfd.texi: $(CHEW_DEP) $(srcdir)/../libbfd.c $(srcdir)/doc.str
139c145
< bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
---
> bfdio.texi: $(CHEW_DEP) $(srcdir)/../bfdio.c $(srcdir)/doc.str
144c150
< bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
---
> bfdwin.texi: $(CHEW_DEP) $(srcdir)/../bfdwin.c $(srcdir)/doc.str
149c155
< opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
---
> opncls.texi: $(CHEW_DEP) $(srcdir)/../opncls.c $(srcdir)/doc.str
154c160
< reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
---
> reloc.texi: $(CHEW_DEP) $(srcdir)/../reloc.c $(srcdir)/doc.str
159c165
< section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
---
> section.texi: $(CHEW_DEP) $(srcdir)/../section.c $(srcdir)/doc.str
164c170
< syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
---
> syms.texi: $(CHEW_DEP) $(srcdir)/../syms.c $(srcdir)/doc.str
169c175
< targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
---
> targets.texi: $(CHEW_DEP) $(srcdir)/../targets.c $(srcdir)/doc.str
174c180
< init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
---
> init.texi: $(CHEW_DEP) $(srcdir)/../init.c $(srcdir)/doc.str
179c185
< hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
---
> hash.texi: $(CHEW_DEP) $(srcdir)/../hash.c $(srcdir)/doc.str
184c190
< linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
---
> linker.texi: $(CHEW_DEP) $(srcdir)/../linker.c $(srcdir)/doc.str
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
* Steve Ellcey wrote on Sat, Jan 29, 2011 at 12:32:15AM CET:
> This patch is intended to be a secondary fix/workaround for the problem
> that can happen when building bfd/doc using a parallel make.   Ralf
> Wildenhues has a fix to move-if-changed that should fix the problem for
> any target where compiling a file multiple times will always result in
> exactly the same binary, but I have at least one platform where this is
> not the case: hppa*-*-hpux*.  So I would also like to have this fix as a
> backup to Ralf's patch (which I think should also go in).

Note that with the changed move-if-change from gnulib, then instead of
your patch, you could just use
  export CMPPROG=cmp --ignore-initial=16'
  make -jN

for a successful build.

Cheers,
Ralf

> 2011-01-28  Steve Ellcey  <[hidden email]>
>
> PR binutils/12283
> * configure.in: Add --enable-parallel-doc flag.
> * configure: Regenerate.
> * doc/Makefile.am: Add CHEW_DEP variable.
> * doc/Makefile.in: Regenerate.
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Steve Ellcey
On Sat, 2011-01-29 at 10:42 +0100, Ralf Wildenhues wrote:

> * Steve Ellcey wrote on Sat, Jan 29, 2011 at 12:32:15AM CET:
> > This patch is intended to be a secondary fix/workaround for the problem
> > that can happen when building bfd/doc using a parallel make.   Ralf
> > Wildenhues has a fix to move-if-changed that should fix the problem for
> > any target where compiling a file multiple times will always result in
> > exactly the same binary, but I have at least one platform where this is
> > not the case: hppa*-*-hpux*.  So I would also like to have this fix as a
> > backup to Ralf's patch (which I think should also go in).
>
> Note that with the changed move-if-change from gnulib, then instead of
> your patch, you could just use
>   export CMPPROG=cmp --ignore-initial=16'
>   make -jN
>
> for a successful build.
>
> Cheers,
> Ralf

I tried that method but it did not work.  When I use 'cmp
--ignore-initial=16' on object files (.o's) it works fine, but when I
use it to compare the chew binary I get a difference beyond the first 16
bytes (at byte 111 or 112 depending on the binary).

Steve Ellcey
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Ralf Wildenhues
* Steve Ellcey wrote on Mon, Jan 31, 2011 at 07:33:01PM CET:

> On Sat, 2011-01-29 at 10:42 +0100, Ralf Wildenhues wrote:
> > * Steve Ellcey wrote on Sat, Jan 29, 2011 at 12:32:15AM CET:
> > > This patch is intended to be a secondary fix/workaround for the problem
> > > that can happen when building bfd/doc using a parallel make.   Ralf
> > > Wildenhues has a fix to move-if-changed that should fix the problem for
> > > any target where compiling a file multiple times will always result in
> > > exactly the same binary, but I have at least one platform where this is
> > > not the case: hppa*-*-hpux*.  So I would also like to have this fix as a
> > > backup to Ralf's patch (which I think should also go in).
> >
> > Note that with the changed move-if-change from gnulib, then instead of
> > your patch, you could just use
> >   export CMPPROG=cmp --ignore-initial=16'
> >   make -jN
> >
> > for a successful build.

> I tried that method but it did not work.  When I use 'cmp
> --ignore-initial=16' on object files (.o's) it works fine, but when I
> use it to compare the chew binary I get a difference beyond the first 16
> bytes (at byte 111 or 112 depending on the binary).

Still, I don't like the idea of requiring a configure switch in order
for parallel builds to work; they should just work OOTB.

Maybe we can help things here by going through another indirection,
that should avoid multiple simultaneous compiles of chew.c.

Does the (little-tested) patch below work for you?

Are you using GNU make by the way, or HP-UX make?  I can only warn
against using the latter:
http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/7535/focus=7548

Thanks,
Ralf

bfd/doc/ChangeLog:
2011-02-04  Ralf Wildenhues  <[hidden email]>

        PR binutils/12283
        * Makefile.am (stamp-chew): New target.
        Use throughout as dependency for targets that need chew,
        instead of depdending on chew.c or on chew directly.
        * Makefile.in: Regenerate.

Index: bfd/doc/Makefile.am
===================================================================
RCS file: /cvs/src/src/bfd/doc/Makefile.am,v
retrieving revision 1.28
diff -u -r1.28 Makefile.am
--- bfd/doc/Makefile.am 22 Aug 2009 19:02:56 -0000 1.28
+++ bfd/doc/Makefile.am 4 Feb 2011 06:27:26 -0000
@@ -64,6 +64,10 @@
   $(H_CFLAGS) $(AM_CPPFLAGS) $(srcdir)/chew.c; \
  $(SHELL) $(srcdir)/../../move-if-change chew.$$$$ $(MKDOC)
 
+stamp-chew: $(srcdir)/chew.c
+ $(MAKE) $(MKDOC)
+ echo stamp >$@
+
 protos: libbfd.h libcoff.h bfd.h
 
 # We can't replace these rules with an implicit rule, because
@@ -74,115 +78,93 @@
 # program.  If somebody tries to rebuild info, but none of the .texi files
 # have changed, then nothing will be rebuilt.
 
-aoutx.texi: chew.c $(srcdir)/../aoutx.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+aoutx.texi: stamp-chew $(srcdir)/../aoutx.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../aoutx.h >aoutx.tmp
  $(SHELL) $(srcdir)/../../move-if-change aoutx.tmp aoutx.texi
 
-archive.texi: chew.c $(srcdir)/../archive.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+archive.texi: stamp-chew $(srcdir)/../archive.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../archive.c >archive.tmp
  $(SHELL) $(srcdir)/../../move-if-change archive.tmp archive.texi
 
-archures.texi: chew.c $(srcdir)/../archures.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+archures.texi: stamp-chew $(srcdir)/../archures.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../archures.c >archures.tmp
  $(SHELL) $(srcdir)/../../move-if-change archures.tmp archures.texi
 
 # We use bfdt.texi, rather than bfd.texi, to avoid conflicting with
 # bfd.texinfo on an 8.3 filesystem.
-bfdt.texi: chew.c $(srcdir)/../bfd.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdt.texi: stamp-chew $(srcdir)/../bfd.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfd.c >bfd.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfd.tmp bfdt.texi
 
-cache.texi: chew.c $(srcdir)/../cache.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+cache.texi: stamp-chew $(srcdir)/../cache.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../cache.c >cache.tmp
  $(SHELL) $(srcdir)/../../move-if-change cache.tmp cache.texi
 
-coffcode.texi: chew.c $(srcdir)/../coffcode.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+coffcode.texi: stamp-chew $(srcdir)/../coffcode.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../coffcode.h >coffcode.tmp
  $(SHELL) $(srcdir)/../../move-if-change coffcode.tmp coffcode.texi
 
-core.texi: chew.c $(srcdir)/../corefile.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+core.texi: stamp-chew $(srcdir)/../corefile.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../corefile.c >core.tmp
  $(SHELL) $(srcdir)/../../move-if-change core.tmp core.texi
 
-elf.texi: chew.c $(srcdir)/../elf.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+elf.texi: stamp-chew $(srcdir)/../elf.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elf.c >elf.tmp
  $(SHELL) $(srcdir)/../../move-if-change elf.tmp elf.texi
 
-elfcode.texi: chew.c $(srcdir)/../elfcode.h $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+elfcode.texi: stamp-chew $(srcdir)/../elfcode.h $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../elfcode.h >elfcode.tmp
  $(SHELL) $(srcdir)/../../move-if-change elfcode.tmp elfcode.texi
 
-mmo.texi: chew.c $(srcdir)/../mmo.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+mmo.texi: stamp-chew $(srcdir)/../mmo.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../mmo.c >mmo.tmp
  $(SHELL) $(srcdir)/../../move-if-change mmo.tmp mmo.texi
 
-format.texi: chew.c $(srcdir)/../format.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+format.texi: stamp-chew $(srcdir)/../format.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../format.c >format.tmp
  $(SHELL) $(srcdir)/../../move-if-change format.tmp format.texi
 
-libbfd.texi: chew.c $(srcdir)/../libbfd.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+libbfd.texi: stamp-chew $(srcdir)/../libbfd.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../libbfd.c >libbfd.tmp
  $(SHELL) $(srcdir)/../../move-if-change libbfd.tmp libbfd.texi
 
-bfdio.texi: chew.c $(srcdir)/../bfdio.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdio.texi: stamp-chew $(srcdir)/../bfdio.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdio.c >bfdio.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfdio.tmp bfdio.texi
 
-bfdwin.texi: chew.c $(srcdir)/../bfdwin.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+bfdwin.texi: stamp-chew $(srcdir)/../bfdwin.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str < $(srcdir)/../bfdwin.c >bfdwin.tmp
  $(SHELL) $(srcdir)/../../move-if-change bfdwin.tmp bfdwin.texi
 
-opncls.texi: chew.c $(srcdir)/../opncls.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+opncls.texi: stamp-chew $(srcdir)/../opncls.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str  <$(srcdir)/../opncls.c >opncls.tmp
  $(SHELL) $(srcdir)/../../move-if-change opncls.tmp opncls.texi
 
-reloc.texi: chew.c $(srcdir)/../reloc.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+reloc.texi: stamp-chew $(srcdir)/../reloc.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../reloc.c >reloc.tmp
  $(SHELL) $(srcdir)/../../move-if-change reloc.tmp reloc.texi
 
-section.texi: chew.c $(srcdir)/../section.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+section.texi: stamp-chew $(srcdir)/../section.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../section.c >section.tmp
  $(SHELL) $(srcdir)/../../move-if-change section.tmp section.texi
 
-syms.texi: chew.c $(srcdir)/../syms.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+syms.texi: stamp-chew $(srcdir)/../syms.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../syms.c >syms.tmp
  $(SHELL) $(srcdir)/../../move-if-change syms.tmp syms.texi
 
-targets.texi: chew.c $(srcdir)/../targets.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+targets.texi: stamp-chew $(srcdir)/../targets.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../targets.c >targets.tmp
  $(SHELL) $(srcdir)/../../move-if-change targets.tmp targets.texi
 
-init.texi: chew.c $(srcdir)/../init.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+init.texi: stamp-chew $(srcdir)/../init.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../init.c >init.tmp
  $(SHELL) $(srcdir)/../../move-if-change init.tmp init.texi
 
-hash.texi: chew.c $(srcdir)/../hash.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+hash.texi: stamp-chew $(srcdir)/../hash.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../hash.c >hash.tmp
  $(SHELL) $(srcdir)/../../move-if-change hash.tmp hash.texi
 
-linker.texi: chew.c $(srcdir)/../linker.c $(srcdir)/doc.str
- $(MAKE) $(MKDOC)
+linker.texi: stamp-chew $(srcdir)/../linker.c $(srcdir)/doc.str
  ./$(MKDOC) -f $(srcdir)/doc.str <$(srcdir)/../linker.c >linker.tmp
  $(SHELL) $(srcdir)/../../move-if-change linker.tmp linker.texi
 
@@ -198,7 +180,7 @@
  $(srcdir)/../elf.c \
  $(srcdir)/header.sed \
  $(srcdir)/proto.str \
- $(MKDOC)
+ stamp-chew
 
 libbfd.h: $(LIBBFD_H_DEP)
  echo "$(LIBBFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
@@ -217,7 +199,7 @@
  $(srcdir)/../coffcode.h \
  $(srcdir)/header.sed \
  $(srcdir)/proto.str \
- $(MKDOC)
+ stamp-chew
 
 libcoff.h: $(LIBCOFF_H_DEP)
  echo "$(LIBCOFF_H_DEP)" | sed -f $(srcdir)/header.sed > $@
@@ -253,7 +235,7 @@
  $(srcdir)/header.sed \
  $(srcdir)/proto.str \
  $(srcdir)/../version.h \
- $(MKDOC)
+ stamp-chew
 
 bfd.h: $(BFD_H_DEP)
  echo "$(BFD_H_DEP)" | sed -f $(srcdir)/header.sed > $@
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Andreas Schwab-2
Ralf Wildenhues <[hidden email]> writes:

> bfd/doc/ChangeLog:
> 2011-02-04  Ralf Wildenhues  <[hidden email]>
>
> PR binutils/12283
> * Makefile.am (stamp-chew): New target.
> Use throughout as dependency for targets that need chew,
> instead of depdending on chew.c or on chew directly.
> * Makefile.in: Regenerate.

I think that means that stamp-chew will need to be distributed, since
the distributed *.texi files depend on it.

Andreas.

--
Andreas Schwab, [hidden email]
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Reply | Threaded
Open this post in threaded view
|

Re: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build

Steve Ellcey
In reply to this post by Ralf Wildenhues
On Fri, 2011-02-04 at 07:34 +0100, Ralf Wildenhues wrote:

> Still, I don't like the idea of requiring a configure switch in order
> for parallel builds to work; they should just work OOTB.
>
> Maybe we can help things here by going through another indirection,
> that should avoid multiple simultaneous compiles of chew.c.
>
> Does the (little-tested) patch below work for you?

It works fine for me.  chew is only built once so there is no problem.
>
> Are you using GNU make by the way, or HP-UX make?  I can only warn
> against using the latter:
> http://thread.gmane.org/gmane.comp.sysutils.autoconf.patches/7535/focus=7548

I use GNU make.

Steve Ellcey
[hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: PATCH: import move-if-change from gnulib (was: PATCH: PR binutils/12283: bfd/doc doesn't support parallel build)

Ralf Wildenhues
In reply to this post by Ralf Wildenhues
* Ralf Wildenhues wrote on Fri, Jan 28, 2011 at 09:14:52PM CET:
> I hereby propose to just import the gnulib copy into GCC and src,
> http://git.savannah.gnu.org/cgit/gnulib.git/tree/build-aux/move-if-change
> and document the change in status as below in patches to src/MAINTAINERS
> and GCC www.  (The Autoconf copy of move-if-change has been updated from
> the gnulib one anyway.)
>
> Any reasons against doing so?

Nobody complained, so I'm importing move-if-change from gnulib in GCC
and src now, to fix this half of the problem in the PR.

The wwwdocs change has been approved off-list.

Thanks,
Ralf

Import move-if-change script from gnulib.

/:
        PR binutils/12283
        * move-if-change: Import version from gnulib.

diff --git a/move-if-change b/move-if-change
index ff74a55..e7ba25e 100755
--- a/move-if-change
+++ b/move-if-change
@@ -2,21 +2,82 @@
 # Like mv $1 $2, but if the files are the same, just delete $1.
 # Status is zero if successful, nonzero otherwise.
 
-usage="$0: usage: $0 SOURCE DEST"
+VERSION='2011-01-28 20:09'; # UTC
+# The definition above must lie within the first 8 lines in order
+# for the Emacs time-stamp write hook (at end) to update it.
+# If you change this file with Emacs, please let the write hook
+# do its job.  Otherwise, update this string manually.
 
-case $# in
-2) ;;
-*) echo "$usage" >&2; exit 1;;
-esac
+# Copyright (C) 2002-2007, 2009-2011 Free Software Foundation, Inc.
 
-for arg in "$1" "$2"; do
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+usage="usage: $0 SOURCE DEST"
+
+help="$usage
+  or:  $0 OPTION
+If SOURCE is different than DEST, then move it to DEST; else remove SOURCE.
+
+  --help     display this help and exit
+  --version  output version information and exit
+
+The variable CMPPROG can be used to specify an alternative to \`cmp'.
+
+Report bugs to <[hidden email]>."
+
+version=`expr "$VERSION" : '\([^ ]*\)'`
+version="move-if-change (gnulib) $version
+Copyright (C) 2011 Free Software Foundation, Inc.
+License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
+This is free software: you are free to change and redistribute it.
+There is NO WARRANTY, to the extent permitted by law."
+
+cmpprog=${CMPPROG-cmp}
+
+for arg
+do
   case $arg in
-   -*) echo "$usage" >&2; exit 1;;
+    --help | --hel | --he | --h)
+      exec echo "$help" ;;
+    --version | --versio | --versi | --vers | --ver | --ve | --v)
+      exec echo "$version" ;;
+    --)
+      shift
+      break ;;
+    -*)
+      echo "$0: invalid option: $arg" >&2
+      exit 1 ;;
+    *)
+      break ;;
   esac
 done
 
-if test -r "$2" && cmp -s "$1" "$2"; then
-  rm -f "$1"
+test $# -eq 2 || { echo "$0: $usage" >&2; exit 1; }
+
+if test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null; then
+  rm -f -- "$1"
 else
-  mv -f "$1" "$2"
+  if mv -f -- "$1" "$2"; then :; else
+    # Ignore failure due to a concurrent move-if-change.
+    test -r "$2" && $cmpprog -- "$1" "$2" >/dev/null && rm -f -- "$1"
+  fi
 fi
+
+## Local Variables:
+## eval: (add-hook 'write-file-hooks 'time-stamp)
+## time-stamp-start: "VERSION='"
+## time-stamp-format: "%:y-%02m-%02d %02H:%02M"
+## time-stamp-time-zone: "UTC"
+## time-stamp-end: "'; # UTC"
+## End:
12