[binutils-gdb] s390: Do not generate incomplete opcode table

Jens Remus jremus@sourceware.org
Thu Oct 30 13:41:07 GMT 2025


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=aa4fbe8859561862cd27cb9eac871082e94ac47b

commit aa4fbe8859561862cd27cb9eac871082e94ac47b
Author: Jens Remus <jremus@linux.ibm.com>
Date:   Thu Oct 30 14:39:59 2025 +0100

    s390: Do not generate incomplete opcode table
    
    The s390 opcode table s390-opc.tbl is generated from s390-opc.txt
    using the s390-mkopc utility using output redirection.  If s390-mkopc
    fails with a non-zero return code, e.g. due to a warning or error, an
    incomplete opcode table may be generated in the build directory.  A
    subsequent invocation of make then assumes that incomplete opcode
    table to be up to date.  Depending on the s390-mkopc issue the build
    may then proceed without any follow-on warnings or errors, causing
    the preceding error or warning to go unnoticed.
    
    Generate the s390 opcode table into an intermediate temporary file
    s390-opc.tbl.tmp in the build directory and only move it to the final
    target s390-opc.tbl if the generation was successful.
    
    Tested by appending an unsupported inline comment "# TEST" to one of
    the instructions defined in s390-opc.txt.
    
    opcodes/
            * Makefile.am (s390-opc.tab): Use an intermediate temporary file
            to prevent updating of the target on error/warning.
            * Makefile.in: Regenerated.
    
    Signed-off-by: Jens Remus <jremus@linux.ibm.com>

Diff:
---
 opcodes/Makefile.am | 3 ++-
 opcodes/Makefile.in | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index a8642c4d07e..c5b055dad57 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -583,7 +583,8 @@ s390-mkopc.o: s390-mkopc.c $(INCDIR)/opcode/s390.h
 	$(AM_V_CC)$(COMPILE_FOR_BUILD) -c $(srcdir)/s390-mkopc.c
 
 s390-opc.tab: s390-mkopc$(EXEEXT_FOR_BUILD) s390-opc.txt
-	$(AM_V_GEN)./s390-mkopc$(EXEEXT_FOR_BUILD) < $(srcdir)/s390-opc.txt > s390-opc.tab
+	$(AM_V_GEN)./s390-mkopc$(EXEEXT_FOR_BUILD) < $(srcdir)/s390-opc.txt > s390-opc.tab.tmp
+	$(AM_V_at)$(am__mv) s390-opc.tab.tmp s390-opc.tab
 
 s390-opc.lo: s390-opc.tab
 
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index ed61dfcf435..0aeeb81d705 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -1562,7 +1562,8 @@ s390-mkopc.o: s390-mkopc.c $(INCDIR)/opcode/s390.h
 	$(AM_V_CC)$(COMPILE_FOR_BUILD) -c $(srcdir)/s390-mkopc.c
 
 s390-opc.tab: s390-mkopc$(EXEEXT_FOR_BUILD) s390-opc.txt
-	$(AM_V_GEN)./s390-mkopc$(EXEEXT_FOR_BUILD) < $(srcdir)/s390-opc.txt > s390-opc.tab
+	$(AM_V_GEN)./s390-mkopc$(EXEEXT_FOR_BUILD) < $(srcdir)/s390-opc.txt > s390-opc.tab.tmp
+	$(AM_V_at)$(am__mv) s390-opc.tab.tmp s390-opc.tab
 
 s390-opc.lo: s390-opc.tab


More information about the Binutils-cvs mailing list