opcodes: Make i386-init.h depend on i386-tbl.h
Checks
Commit Message
i386-gen will generate both i386-tbl.h and i386-init.h in one go. Since
both i386-tbl.h and i386-init.h depend on i386-gen, it leads to a race
condition for i386-gen. Make i386-init.h depend on i386-tbl.h to avoid
the race condition.
* Makefile.am ($(srcdir)/i386%tbl.h $(srcdir)/i386%init.h):
Removed.
($(srcdir)/i386-tbl.h): New rule.
($(srcdir)/i386-init.h): Likewise.
* Makefile.in: Regenerated.
---
opcodes/Makefile.am | 8 +++++---
opcodes/Makefile.in | 8 +++++---
2 files changed, 10 insertions(+), 6 deletions(-)
Comments
On 01.12.2022 17:20, H.J. Lu via Binutils wrote:
> i386-gen will generate both i386-tbl.h and i386-init.h in one go. Since
> both i386-tbl.h and i386-init.h depend on i386-gen, it leads to a race
> condition for i386-gen.
This is not true - the use of a pattern rule was specifically introduced
(not very long ago) to signal to make the creation of multiple files by
a single command / rule. What you describe would happen if this rule
wasn't a pattern one. You are in fact ...
> Make i386-init.h depend on i386-tbl.h to avoid
> the race condition.
... proposing to re-introduce the original problem (just in the
opposite direction) - see commit 79d635fc64ba.
Jan
On Thu, Dec 1, 2022 at 9:08 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 01.12.2022 17:20, H.J. Lu via Binutils wrote:
> > i386-gen will generate both i386-tbl.h and i386-init.h in one go. Since
> > both i386-tbl.h and i386-init.h depend on i386-gen, it leads to a race
> > condition for i386-gen.
>
> This is not true - the use of a pattern rule was specifically introduced
> (not very long ago) to signal to make the creation of multiple files by
> a single command / rule. What you describe would happen if this rule
> wasn't a pattern one. You are in fact ...
I
> > Make i386-init.h depend on i386-tbl.h to avoid
> > the race condition.
>
> ... proposing to re-introduce the original problem (just in the
> opposite direction) - see commit 79d635fc64ba.
>
> Jan
You are right. I found my mistake. This patch is withdrawn.
Thanks.
@@ -553,13 +553,15 @@ i386-gen.o: i386-gen.c i386-opc.h $(srcdir)/../include/opcode/i386.h \
config.h sysdep.h
$(COMPILE_FOR_BUILD) -c $(srcdir)/i386-gen.c
-# i386-gen will generate both headers in one go. Use a pattern rule to properly
-# express this, with the inner dash ('-') arbitrarily chosen to be the stem.
-$(srcdir)/i386%tbl.h $(srcdir)/i386%init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h
+# i386-gen will generate both i386-tbl.h and i386-init.h in one go. Make
+# i386-init.h depend on i386-tbl.h to avoid the race condition.
+$(srcdir)/i386-tbl.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h
$(AM_V_GEN)$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) - \
< $(srcdir)/i386-opc.tbl \
| ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir)
+$(srcdir)/i386-init.h: $(srcdir)/i386-tbl.h
+
i386-opc.lo: $(srcdir)/i386-tbl.h
# While not really a dependency, specify i386-init.h here as well to make sure
# it is generated even if i386-tbl.h is present and up-to-date.
@@ -1528,13 +1528,15 @@ i386-gen.o: i386-gen.c i386-opc.h $(srcdir)/../include/opcode/i386.h \
config.h sysdep.h
$(COMPILE_FOR_BUILD) -c $(srcdir)/i386-gen.c
-# i386-gen will generate both headers in one go. Use a pattern rule to properly
-# express this, with the inner dash ('-') arbitrarily chosen to be the stem.
-$(srcdir)/i386%tbl.h $(srcdir)/i386%init.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h
+# i386-gen will generate both i386-tbl.h and i386-init.h in one go. Make
+# i386-init.h depend on i386-tbl.h to avoid the race condition.
+$(srcdir)/i386-tbl.h: @MAINT@ i386-gen$(EXEEXT_FOR_BUILD) i386-opc.tbl i386-reg.tbl i386-opc.h
$(AM_V_GEN)$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) - \
< $(srcdir)/i386-opc.tbl \
| ./i386-gen$(EXEEXT_FOR_BUILD) --srcdir $(srcdir)
+$(srcdir)/i386-init.h: $(srcdir)/i386-tbl.h
+
i386-opc.lo: $(srcdir)/i386-tbl.h
# While not really a dependency, specify i386-init.h here as well to make sure
# it is generated even if i386-tbl.h is present and up-to-date.