[PATCH 01/28] aarch64: Remove output file if aarch64-gen fails

Alice Carlotti alice.carlotti@arm.com
Wed Nov 4 18:41:05 GMT 2026


If the incomplete output file is left in place, then a subsequent make
invocation won't try again to regenerate it, and the outstanding issue
might only become apparent as a link error later in the build.


diff --git a/opcodes/Makefile.am b/opcodes/Makefile.am
index a0fcf4d5ec7eedb6fe6f07172b27a8c4faada505..2dafcaf40c7261294c5dd6947c68bb41a3bdd4fc 100644
--- a/opcodes/Makefile.am
+++ b/opcodes/Makefile.am
@@ -507,13 +507,13 @@ aarch64-gen.o: aarch64-gen.c $(BFD_H) $(INCDIR)/getopt.h $(INCDIR)/libiberty.h\
 	$(AM_V_CC)$(COMPILE_FOR_BUILD) -c $(srcdir)/aarch64-gen.c
 
 $(srcdir)/aarch64-asm-2.c: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-asm > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-asm > $@ || ( rm $@ && false )
 $(srcdir)/aarch64-dis-2.c: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-dis > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-dis > $@ || ( rm $@ && false )
 $(srcdir)/aarch64-opc-2.c: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-opc > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-opc > $@ || ( rm $@ && false )
 $(srcdir)/aarch64-tbl-2.h: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-idx > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-idx > $@ || ( rm $@ && false )
 
 aarch64-asm-2.lo: $(srcdir)/aarch64-tbl-2.h $(srcdir)/aarch64-asm-2.c
 
diff --git a/opcodes/Makefile.in b/opcodes/Makefile.in
index c5449bebf54dab4f1a589fc9ac188078e4b75733..658eaa67741ffca3f2c130b5abb195515251fd40 100644
--- a/opcodes/Makefile.in
+++ b/opcodes/Makefile.in
@@ -1491,13 +1491,13 @@ aarch64-gen.o: aarch64-gen.c $(BFD_H) $(INCDIR)/getopt.h $(INCDIR)/libiberty.h\
 	$(AM_V_CC)$(COMPILE_FOR_BUILD) -c $(srcdir)/aarch64-gen.c
 
 $(srcdir)/aarch64-asm-2.c: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-asm > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-asm > $@ || ( rm $@ && false )
 $(srcdir)/aarch64-dis-2.c: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-dis > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-dis > $@ || ( rm $@ && false )
 $(srcdir)/aarch64-opc-2.c: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-opc > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-opc > $@ || ( rm $@ && false )
 $(srcdir)/aarch64-tbl-2.h: @MAINT@ aarch64-gen$(exeext_for_build)
-	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-idx > $@
+	$(AM_V_GEN)./aarch64-gen$(exeext_for_build) --gen-idx > $@ || ( rm $@ && false )
 
 aarch64-asm-2.lo: $(srcdir)/aarch64-tbl-2.h $(srcdir)/aarch64-asm-2.c
 


More information about the Binutils mailing list