Merge remote-tracking branch 'origin/nasm-2.14.xx'

Resolved Conflicts:
	Makefile.in
	Mkfiles/msvc.mak
	Mkfiles/openwcom.mak
	asm/nasm.c
	nasmlib/alloc.c

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
This commit is contained in:
H. Peter Anvin (Intel) 2018-12-13 16:43:43 -08:00
commit df2195b6a9
8 changed files with 39 additions and 13 deletions

View File

@ -96,8 +96,9 @@ LIBOBJ = stdlib/snprintf.$(O) stdlib/vsnprintf.$(O) stdlib/strlcpy.$(O) \
stdlib/strnlen.$(O) stdlib/strrchrnul.$(O) \
\
nasmlib/ver.$(O) \
nasmlib/crc64.$(O) nasmlib/alloc.$(O) nasmlib/asprintf.$(O) \
nasmlib/md5c.$(O) nasmlib/string.$(O) nasmlib/nctype.$(O) \
nasmlib/alloc.$(O) nasmlib/asprintf.$(O) nasmlib/errfile.$(O) \
nasmlib/crc64.$(O) nasmlib/md5c.$(O) \
nasmlib/string.$(O) nasmlib/nctype.$(O) \
nasmlib/file.$(O) nasmlib/mmap.$(O) nasmlib/ilog2.$(O) \
nasmlib/realpath.$(O) nasmlib/path.$(O) \
nasmlib/filename.$(O) \

View File

@ -68,8 +68,9 @@ LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) \
stdlib\strnlen.$(O) stdlib\strrchrnul.$(O) \
\
nasmlib\ver.$(O) \
nasmlib\crc64.$(O) nasmlib\alloc.$(O) nasmlib\asprintf.$(O) \
nasmlib\md5c.$(O) nasmlib\string.$(O) nasmlib\nctype.$(O) \
nasmlib\alloc.$(O) nasmlib\asprintf.$(O) nasmlib\errfile.$(O) \
nasmlib\crc64.$(O) nasmlib\md5c.$(O) \
nasmlib\string.$(O) nasmlib\nctype.$(O) \
nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) \
nasmlib\realpath.$(O) nasmlib\path.$(O) \
nasmlib\filename.$(O) \

View File

@ -57,8 +57,9 @@ LIBOBJ = stdlib\snprintf.$(O) stdlib\vsnprintf.$(O) stdlib\strlcpy.$(O) &
stdlib\strnlen.$(O) stdlib\strrchrnul.$(O) &
&
nasmlib\ver.$(O) &
nasmlib\crc64.$(O) nasmlib\alloc.$(O) nasmlib\asprintf.$(O) &
nasmlib\md5c.$(O) nasmlib\string.$(O) nasmlib\nctype.$(O) &
nasmlib\alloc.$(O) nasmlib\asprintf.$(O) nasmlib\errfile.$(O) &
nasmlib\crc64.$(O) nasmlib\md5c.$(O) &
nasmlib\string.$(O) nasmlib\nctype.$(O) &
nasmlib\file.$(O) nasmlib\mmap.$(O) nasmlib\ilog2.$(O) &
nasmlib\realpath.$(O) nasmlib\path.$(O) &
nasmlib\filename.$(O) &

View File

@ -121,7 +121,7 @@ const struct ofmt *ofmt = &OF_DEFAULT;
const struct ofmt_alias *ofmt_alias = NULL;
const struct dfmt *dfmt;
static FILE *error_file; /* Where to write error messages */
FILE *error_file; /* Where to write error messages */
FILE *ofile = NULL;
struct optimization optimizing =
@ -451,6 +451,8 @@ int main(int argc, char **argv)
{
timestamp();
error_file = stderr;
iflag_set_default_cpu(&cpu);
iflag_set_default_cpu(&cmd_cpu);
@ -460,8 +462,6 @@ int main(int argc, char **argv)
want_usage = terminate_after_phase = false;
nasm_set_verror(nasm_verror_asm);
error_file = stderr;
nasm_ctype_init();
src_init();

View File

@ -40,6 +40,11 @@
#include "compiler.h"
/*
* File pointer for error messages
*/
extern FILE *error_file; /* Error file descriptor */
/*
* An error reporting function should look like this.
*/

View File

@ -42,7 +42,23 @@
no_return nasm_alloc_failed(void)
{
nasm_fatal("out of memory");
/* If nasm_fatal() gets us back here, then croak hard */
static bool already_here = false;
FILE *errfile;
if (likely(!already_here)) {
already_here = true;
nasm_fatal("out of memory!");
}
errfile = error_file;
if (!errfile)
error_file = stderr;
fprintf(error_file, "nasm: out of memory!\n");
fflush(error_file);
fflush(NULL);
abort();
}
void *nasm_malloc(size_t size)

5
nasmlib/errfile.c Normal file
View File

@ -0,0 +1,5 @@
#include "compiler.h"
#include <stdio.h>
FILE *error_file;

View File

@ -126,9 +126,6 @@ char *generic_rec_file = NULL;
/* module name to be added at the beginning of output file */
char *modname_specified = NULL;
/* error file */
static FILE *error_file;
/* the header of the output file, built up stage by stage */
rdf_headerbuf *newheader = NULL;