Always remove a stale list file

Remove the list file before running the first pass, so in case we
die before running pass 2 then there won't be a stale list file
sitting around.

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin 2017-04-02 19:10:26 -07:00
parent 8f62246560
commit aac01ff479
2 changed files with 15 additions and 12 deletions

View File

@ -1207,6 +1207,9 @@ static void assemble_file(char *fname, StrList **depend_ptr)
cpu = cmd_cpu;
if (pass0 == 2) {
lfmt->init(listname);
} else if (passn == 1 && *listname) {
/* Remove the list file in case we die before the output pass */
remove(listname);
}
in_absolute = false;
global_offset_changed = 0; /* set by redefine_label */

View File

@ -10,40 +10,40 @@ $(NASM):
$(MAKE) -C ..
%.bin: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $<
%.ith: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f ith -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f ith -o $@ -l $*.lst $<
%.srec: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f srec -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f srec -o $@ -l $*.lst $<
%.o: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f elf32 -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f elf32 -o $@ -l $*.lst $<
%.o64: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f elf64 -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f elf64 -o $@ -l $*.lst $<
%.obj: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f obj -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f obj -o $@ -l $*.lst $<
%.coff: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f coff -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f coff -o $@ -l $*.lst $<
%.win32: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f win32 -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f win32 -o $@ -l $*.lst $<
%.win64: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f win64 -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f win64 -o $@ -l $*.lst $<
%.mo32: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f macho32 -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f macho32 -o $@ -l $*.lst $<
%.mo64: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f macho64 -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f macho64 -o $@ -l $*.lst $<
%.dbg: %.asm $(NASM)
$(RM) $*.lst ; $(NASM) $(NASMOPT) -f dbg -o $@ -l $*.lst $<
$(NASM) $(NASMOPT) -f dbg -o $@ -l $*.lst $<
%.asm: %.pl
$(PERL) $< > $@