mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-10-10 00:25:06 -04:00
Merge remote-tracking branch 'origin/nasm-2.12.xx'
Resolved Conflicts: output/codeview.c output/outelf32.c output/outelf64.c output/outelfx32.c output/outform.c output/outform.h output/outieee.c output/outobj.c Signed-off-by: H. Peter Anvin <hpa@zytor.com>
This commit is contained in:
@@ -359,7 +359,7 @@ listing.$(O): listing.c compiler.h config.h directiv.h insnsi.h listing.h \
|
|||||||
macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
|
macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h \
|
||||||
nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
|
nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h \
|
||||||
tables.h
|
tables.h
|
||||||
md5c.$(O): md5c.c md5.h
|
md5c.$(O): md5c.c compiler.h config.h md5.h
|
||||||
nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
|
nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
|
||||||
iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h \
|
iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h \
|
||||||
opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h \
|
opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h \
|
||||||
|
@@ -5,6 +5,9 @@
|
|||||||
#
|
#
|
||||||
# Make sure to put the appropriate directories in your PATH, in
|
# Make sure to put the appropriate directories in your PATH, in
|
||||||
# the case of MSVC++ 2005, they are ...\VC\bin and ...\Common7\IDE.
|
# the case of MSVC++ 2005, they are ...\VC\bin and ...\Common7\IDE.
|
||||||
|
#
|
||||||
|
# This is typically done by opening the Visual Studio Command Prompt.
|
||||||
|
#
|
||||||
|
|
||||||
top_srcdir = .
|
top_srcdir = .
|
||||||
srcdir = .
|
srcdir = .
|
||||||
@@ -18,7 +21,7 @@ mandir = $(prefix)/man
|
|||||||
CFLAGS = /Od /Zi
|
CFLAGS = /Od /Zi
|
||||||
LDFLAGS = /DEBUG
|
LDFLAGS = /DEBUG
|
||||||
!ELSE
|
!ELSE
|
||||||
CFLAGS = /O2 /Ox /Oy
|
CFLAGS = /O2
|
||||||
!ENDIF
|
!ENDIF
|
||||||
|
|
||||||
CC = cl
|
CC = cl
|
||||||
@@ -264,7 +267,7 @@ listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
|
|||||||
nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
|
nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
|
||||||
macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
|
macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
|
||||||
nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
|
nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
|
||||||
md5c.$(O): md5c.c md5.h
|
md5c.$(O): md5c.c compiler.h md5.h
|
||||||
nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
|
nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
|
||||||
iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
|
iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
|
||||||
output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
|
output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
|
||||||
|
@@ -172,7 +172,7 @@ listing.o: listing.c compiler.h config.h directiv.h insnsi.h listing.h \
|
|||||||
nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
|
nasm.h nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
|
||||||
macros.o: macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h nasm.h \
|
macros.o: macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h nasm.h \
|
||||||
nasmlib.h opflags.h outform.h pptok.h preproc.h regs.h tables.h
|
nasmlib.h opflags.h outform.h pptok.h preproc.h regs.h tables.h
|
||||||
md5c.o: md5c.c md5.h
|
md5c.o: md5c.c compiler.h config.h md5.h
|
||||||
nasm.o: nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
|
nasm.o: nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h \
|
||||||
iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h \
|
iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h \
|
||||||
opflags.h outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
|
opflags.h outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
|
||||||
|
@@ -310,7 +310,7 @@ listing.$(O): listing.c compiler.h config.h directiv.h insnsi.h listing.h &
|
|||||||
macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h &
|
macros.$(O): macros.c compiler.h config.h directiv.h hashtbl.h insnsi.h &
|
||||||
nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h &
|
nasm.h nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h &
|
||||||
tables.h
|
tables.h
|
||||||
md5c.$(O): md5c.c md5.h
|
md5c.$(O): md5c.c compiler.h config.h md5.h
|
||||||
nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h &
|
nasm.$(O): nasm.c assemble.h compiler.h config.h directiv.h eval.h float.h &
|
||||||
iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h &
|
iflag.h iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h &
|
||||||
opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h &
|
opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h &
|
||||||
|
@@ -278,7 +278,7 @@ listing.$(O): listing.c compiler.h directiv.h insnsi.h listing.h nasm.h \
|
|||||||
nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
|
nasmlib.h opflags.h pptok.h preproc.h regs.h tables.h
|
||||||
macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
|
macros.$(O): macros.c compiler.h directiv.h hashtbl.h insnsi.h nasm.h \
|
||||||
nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
|
nasmlib.h opflags.h output/outform.h pptok.h preproc.h regs.h tables.h
|
||||||
md5c.$(O): md5c.c md5.h
|
md5c.$(O): md5c.c compiler.h md5.h
|
||||||
nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
|
nasm.$(O): nasm.c assemble.h compiler.h directiv.h eval.h float.h iflag.h \
|
||||||
iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
|
iflaggen.h insns.h insnsi.h labels.h listing.h nasm.h nasmlib.h opflags.h \
|
||||||
output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
|
output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h stdscan.h \
|
||||||
|
@@ -14,6 +14,9 @@ since 2007.
|
|||||||
|
|
||||||
\b Fix error when not specifying a list file.
|
\b Fix error when not specifying a list file.
|
||||||
|
|
||||||
|
\b Correct the handling of macro-local labels in the Codeview
|
||||||
|
debugging format.
|
||||||
|
|
||||||
\b Add \c{CLZERO}, \c{MONITORX} and \c{MWAITX} instructions.
|
\b Add \c{CLZERO}, \c{MONITORX} and \c{MWAITX} instructions.
|
||||||
|
|
||||||
|
|
||||||
|
@@ -3824,17 +3824,6 @@ variable, for example:
|
|||||||
\c %defstr C_colon %!'C:'
|
\c %defstr C_colon %!'C:'
|
||||||
|
|
||||||
|
|
||||||
\H{comment} Comment Blocks: \i\c{%comment}
|
|
||||||
|
|
||||||
The \c{%comment} and \c{%endcomment} directives are used to specify
|
|
||||||
a block of commented (i.e. unprocessed) code/text. Everything between
|
|
||||||
\c{%comment} and \c{%endcomment} will be ignored by the preprocessor.
|
|
||||||
|
|
||||||
\c %comment
|
|
||||||
\c ; some code, text or data to be ignored
|
|
||||||
\c %endcomment
|
|
||||||
|
|
||||||
|
|
||||||
\H{stdmac} \i{Standard Macros}
|
\H{stdmac} \i{Standard Macros}
|
||||||
|
|
||||||
NASM defines a set of standard macros, which are already defined
|
NASM defines a set of standard macros, which are already defined
|
||||||
|
42
labels.c
42
labels.c
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2014 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -126,6 +126,22 @@ static bool initialized = false;
|
|||||||
char lprefix[PREFIX_MAX] = { 0 };
|
char lprefix[PREFIX_MAX] = { 0 };
|
||||||
char lpostfix[PREFIX_MAX] = { 0 };
|
char lpostfix[PREFIX_MAX] = { 0 };
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Emit a symdef to the output and the debug format backends.
|
||||||
|
*/
|
||||||
|
static void out_symdef(char *name, int32_t segment, int64_t offset,
|
||||||
|
int is_global, char *special)
|
||||||
|
{
|
||||||
|
ofmt->symdef(name, segment, offset, is_global, special);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* NASM special symbols are not passed to the debug format; none
|
||||||
|
* of the current backends want to see them.
|
||||||
|
*/
|
||||||
|
if (!(name[0] == '.' && name[1] == '.' && name[2] != '@'))
|
||||||
|
dfmt->debug_deflabel(name, segment, offset, is_global, special);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Internal routine: finds the `union label' corresponding to the
|
* Internal routine: finds the `union label' corresponding to the
|
||||||
* given label name. Creates a new one, if it isn't found, and if
|
* given label name. Creates a new one, if it isn't found, and if
|
||||||
@@ -260,16 +276,12 @@ void redefine_label(char *label, int32_t segment, int64_t offset, char *special,
|
|||||||
snprintf(xsymbol, slen, "%s%s%s", lprefix, lptr->defn.label,
|
snprintf(xsymbol, slen, "%s%s%s", lprefix, lptr->defn.label,
|
||||||
lpostfix);
|
lpostfix);
|
||||||
|
|
||||||
ofmt->symdef(xsymbol, segment, offset, exi,
|
out_symdef(xsymbol, segment, offset, exi,
|
||||||
special ? special : lptr->defn.special);
|
special ? special : lptr->defn.special);
|
||||||
dfmt->debug_deflabel(xsymbol, segment, offset, exi,
|
/** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/
|
||||||
special ? special : lptr->defn.special);
|
|
||||||
/** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/
|
|
||||||
} else {
|
} else {
|
||||||
if ((lptr->defn.is_global & (GLOBAL_BIT | EXTERN_BIT)) != EXTERN_BIT) {
|
if ((lptr->defn.is_global & (GLOBAL_BIT | EXTERN_BIT)) != EXTERN_BIT) {
|
||||||
ofmt->symdef(lptr->defn.label, segment, offset, exi,
|
out_symdef(lptr->defn.label, segment, offset, exi,
|
||||||
special ? special : lptr->defn.special);
|
|
||||||
dfmt->debug_deflabel(label, segment, offset, exi,
|
|
||||||
special ? special : lptr->defn.special);
|
special ? special : lptr->defn.special);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -325,16 +337,12 @@ void define_label(char *label, int32_t segment, int64_t offset, char *special,
|
|||||||
snprintf(xsymbol, slen, "%s%s%s", lprefix, lptr->defn.label,
|
snprintf(xsymbol, slen, "%s%s%s", lprefix, lptr->defn.label,
|
||||||
lpostfix);
|
lpostfix);
|
||||||
|
|
||||||
ofmt->symdef(xsymbol, segment, offset, exi,
|
out_symdef(xsymbol, segment, offset, exi,
|
||||||
special ? special : lptr->defn.special);
|
special ? special : lptr->defn.special);
|
||||||
dfmt->debug_deflabel(xsymbol, segment, offset, exi,
|
/** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/
|
||||||
special ? special : lptr->defn.special);
|
|
||||||
/** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/
|
|
||||||
} else {
|
} else {
|
||||||
if ((lptr->defn.is_global & (GLOBAL_BIT | EXTERN_BIT)) != EXTERN_BIT) {
|
if ((lptr->defn.is_global & (GLOBAL_BIT | EXTERN_BIT)) != EXTERN_BIT) {
|
||||||
ofmt->symdef(lptr->defn.label, segment, offset, exi,
|
out_symdef(lptr->defn.label, segment, offset, exi,
|
||||||
special ? special : lptr->defn.special);
|
|
||||||
dfmt->debug_deflabel(label, segment, offset, exi,
|
|
||||||
special ? special : lptr->defn.special);
|
special ? special : lptr->defn.special);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -369,9 +377,7 @@ void define_common(char *label, int32_t segment, int32_t size, char *special)
|
|||||||
if (pass0 == 0)
|
if (pass0 == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ofmt->symdef(lptr->defn.label, segment, size, 2,
|
out_symdef(lptr->defn.label, segment, size, 2,
|
||||||
special ? special : lptr->defn.special);
|
|
||||||
dfmt->debug_deflabel(lptr->defn.label, segment, size, 2,
|
|
||||||
special ? special : lptr->defn.special);
|
special ? special : lptr->defn.special);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
38
nasm.c
38
nasm.c
@@ -85,7 +85,9 @@ static void nasm_verror_vc(int severity, const char *fmt, va_list args);
|
|||||||
static void nasm_verror_common(int severity, const char *fmt, va_list args);
|
static void nasm_verror_common(int severity, const char *fmt, va_list args);
|
||||||
static void usage(void);
|
static void usage(void);
|
||||||
|
|
||||||
static int using_debug_info, opt_verbose_info;
|
static bool using_debug_info, opt_verbose_info;
|
||||||
|
static const char *debug_format;
|
||||||
|
|
||||||
bool tasm_compatible_mode = false;
|
bool tasm_compatible_mode = false;
|
||||||
int pass0, passn;
|
int pass0, passn;
|
||||||
int globalrel = 0;
|
int globalrel = 0;
|
||||||
@@ -356,11 +358,21 @@ int main(int argc, char **argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If debugging info is disabled, suppress any debug calls */
|
if (!using_debug_info) {
|
||||||
if (!using_debug_info)
|
/* No debug info, redirect to the null backend (empty stubs) */
|
||||||
dfmt = &null_debug_form;
|
dfmt = &null_debug_form;
|
||||||
else if (!dfmt)
|
} else if (!debug_format) {
|
||||||
|
/* Default debug format for this backend */
|
||||||
dfmt = ofmt->default_dfmt;
|
dfmt = ofmt->default_dfmt;
|
||||||
|
} else {
|
||||||
|
dfmt = dfmt_find(ofmt, debug_format);
|
||||||
|
if (!dfmt) {
|
||||||
|
nasm_fatal(ERR_NOFILE | ERR_USAGE,
|
||||||
|
"unrecognized debug format `%s' for"
|
||||||
|
" output format `%s'",
|
||||||
|
debug_format, ofmt->shortname);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (ofmt->stdmac)
|
if (ofmt->stdmac)
|
||||||
preproc->extra_stdmac(ofmt->stdmac);
|
preproc->extra_stdmac(ofmt->stdmac);
|
||||||
@@ -464,7 +476,7 @@ int main(int argc, char **argv)
|
|||||||
assemble_file(inname, depend_ptr);
|
assemble_file(inname, depend_ptr);
|
||||||
|
|
||||||
if (!terminate_after_phase) {
|
if (!terminate_after_phase) {
|
||||||
ofmt->cleanup(using_debug_info);
|
ofmt->cleanup();
|
||||||
cleanup_labels();
|
cleanup_labels();
|
||||||
fflush(ofile);
|
fflush(ofile);
|
||||||
if (ferror(ofile))
|
if (ferror(ofile))
|
||||||
@@ -664,7 +676,6 @@ static bool process_arg(char *p, char *q)
|
|||||||
"unrecognised output format `%s' - "
|
"unrecognised output format `%s' - "
|
||||||
"use -hf for a list", param);
|
"use -hf for a list", param);
|
||||||
}
|
}
|
||||||
dfmt = NULL;
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O': /* Optimization level */
|
case 'O': /* Optimization level */
|
||||||
@@ -742,14 +753,8 @@ static bool process_arg(char *p, char *q)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F': /* specify debug format */
|
case 'F': /* specify debug format */
|
||||||
dfmt = dfmt_find(ofmt, param);
|
|
||||||
if (!dfmt) {
|
|
||||||
nasm_fatal(ERR_NOFILE | ERR_USAGE,
|
|
||||||
"unrecognized debug format `%s' for"
|
|
||||||
" output format `%s'",
|
|
||||||
param, ofmt->shortname);
|
|
||||||
}
|
|
||||||
using_debug_info = true;
|
using_debug_info = true;
|
||||||
|
debug_format = param;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'X': /* specify error reporting format */
|
case 'X': /* specify error reporting format */
|
||||||
@@ -765,6 +770,8 @@ static bool process_arg(char *p, char *q)
|
|||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
using_debug_info = true;
|
using_debug_info = true;
|
||||||
|
if (p[2])
|
||||||
|
debug_format = nasm_skip_spaces(p + 2);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
@@ -773,8 +780,7 @@ static bool process_arg(char *p, char *q)
|
|||||||
"[-l listfile]\n"
|
"[-l listfile]\n"
|
||||||
" [options...] [--] filename\n"
|
" [options...] [--] filename\n"
|
||||||
" or nasm -v (or --v) for version info\n\n"
|
" or nasm -v (or --v) for version info\n\n"
|
||||||
" -t assemble in SciTech TASM compatible mode\n"
|
" -t assemble in SciTech TASM compatible mode\n");
|
||||||
" -g generate debug information in selected format\n");
|
|
||||||
printf
|
printf
|
||||||
(" -E (or -e) preprocess only (writes output to stdout by default)\n"
|
(" -E (or -e) preprocess only (writes output to stdout by default)\n"
|
||||||
" -a don't preprocess (assemble only)\n"
|
" -a don't preprocess (assemble only)\n"
|
||||||
@@ -787,7 +793,9 @@ static bool process_arg(char *p, char *q)
|
|||||||
" -MP emit phony target\n\n"
|
" -MP emit phony target\n\n"
|
||||||
" -Z<file> redirect error messages to file\n"
|
" -Z<file> redirect error messages to file\n"
|
||||||
" -s redirect error messages to stdout\n\n"
|
" -s redirect error messages to stdout\n\n"
|
||||||
|
" -g generate debugging information\n\n"
|
||||||
" -F format select a debugging format\n\n"
|
" -F format select a debugging format\n\n"
|
||||||
|
" -gformat same as -g -F format\n\n"
|
||||||
" -o outfile write output to an outfile\n\n"
|
" -o outfile write output to an outfile\n\n"
|
||||||
" -f format select an output format\n\n"
|
" -f format select an output format\n\n"
|
||||||
" -l listfile write listing to a listfile\n\n"
|
" -l listfile write listing to a listfile\n\n"
|
||||||
|
4
nasm.h
4
nasm.h
@@ -844,7 +844,7 @@ struct ofmt {
|
|||||||
* One thing the cleanup routine should always do is to close
|
* One thing the cleanup routine should always do is to close
|
||||||
* the output file pointer.
|
* the output file pointer.
|
||||||
*/
|
*/
|
||||||
void (*cleanup)(int debuginfo);
|
void (*cleanup)(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -892,7 +892,7 @@ struct dfmt {
|
|||||||
/*
|
/*
|
||||||
* debug_deflabel - called whenever a label is defined. Parameters
|
* debug_deflabel - called whenever a label is defined. Parameters
|
||||||
* are the same as to 'symdef()' in the output format. This function
|
* are the same as to 'symdef()' in the output format. This function
|
||||||
* would be called before the output format version.
|
* is called after the output format version.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void (*debug_deflabel)(char *name, int32_t segment, int64_t offset,
|
void (*debug_deflabel)(char *name, int32_t segment, int64_t offset,
|
||||||
|
5
nasm.txt
5
nasm.txt
@@ -47,7 +47,10 @@ OPTIONS
|
|||||||
formats, use the *-y* option (for example *-felf -y*).
|
formats, use the *-y* option (for example *-felf -y*).
|
||||||
|
|
||||||
*-g*::
|
*-g*::
|
||||||
Causes *nasm* to generate debug information in selected format.
|
Causes *nasm* to generate debug information.
|
||||||
|
|
||||||
|
*-g*'format'::
|
||||||
|
Equivalent to **-g -F**__ format__.
|
||||||
|
|
||||||
*-h*::
|
*-h*::
|
||||||
Causes *nasm* to exit immediately, after giving a summary of its
|
Causes *nasm* to exit immediately, after giving a summary of its
|
||||||
|
@@ -188,8 +188,6 @@ static void cv8_linenum(const char *filename, int32_t linenumber,
|
|||||||
static void cv8_deflabel(char *name, int32_t segment, int64_t offset,
|
static void cv8_deflabel(char *name, int32_t segment, int64_t offset,
|
||||||
int is_global, char *special)
|
int is_global, char *special)
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
size_t len;
|
|
||||||
struct cv8_symbol *sym;
|
struct cv8_symbol *sym;
|
||||||
struct coff_Section *s;
|
struct coff_Section *s;
|
||||||
|
|
||||||
@@ -214,21 +212,8 @@ static void cv8_deflabel(char *name, int32_t segment, int64_t offset,
|
|||||||
sym->size = 0;
|
sym->size = 0;
|
||||||
sym->typeindex = 0;
|
sym->typeindex = 0;
|
||||||
|
|
||||||
/* handle local labels */
|
sym->name = nasm_strdup(name);
|
||||||
if (name[0] == '.' && name[1] != '.' && cv8_state.last_sym != NULL) {
|
cv8_state.symbol_lengths += strlen(sym->name) + 1;
|
||||||
len = strlen(cv8_state.last_sym->name) + strlen(name);
|
|
||||||
sym->name = nasm_malloc(len + 1);
|
|
||||||
ret = snprintf(sym->name, len + 1, "%s%s",
|
|
||||||
cv8_state.last_sym->name, name);
|
|
||||||
nasm_assert(ret > 0 && (size_t)ret == len);
|
|
||||||
} else {
|
|
||||||
len = strlen(name);
|
|
||||||
sym->name = nasm_malloc(len + 1);
|
|
||||||
ret = snprintf(sym->name, len + 1, "%s", name);
|
|
||||||
nasm_assert(ret > 0 && (size_t)ret == len);
|
|
||||||
}
|
|
||||||
|
|
||||||
cv8_state.symbol_lengths += len + 1;
|
|
||||||
|
|
||||||
if (cv8_state.last_sym && cv8_state.last_sym->section == segment)
|
if (cv8_state.last_sym && cv8_state.last_sym->section == segment)
|
||||||
cv8_state.last_sym->size = offset - cv8_state.last_sym->secrel;
|
cv8_state.last_sym->size = offset - cv8_state.last_sym->secrel;
|
||||||
|
@@ -211,12 +211,10 @@ static void aoutb_init(void)
|
|||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void aout_cleanup(int debuginfo)
|
static void aout_cleanup(void)
|
||||||
{
|
{
|
||||||
struct Reloc *r;
|
struct Reloc *r;
|
||||||
|
|
||||||
(void)debuginfo;
|
|
||||||
|
|
||||||
aout_pad_sections();
|
aout_pad_sections();
|
||||||
aout_fixup_relocs(&stext);
|
aout_fixup_relocs(&stext);
|
||||||
aout_fixup_relocs(&sdata);
|
aout_fixup_relocs(&sdata);
|
||||||
|
@@ -138,12 +138,10 @@ static void as86_init(void)
|
|||||||
as86_add_string(as86_module);
|
as86_add_string(as86_module);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void as86_cleanup(int debuginfo)
|
static void as86_cleanup(void)
|
||||||
{
|
{
|
||||||
struct Piece *p;
|
struct Piece *p;
|
||||||
|
|
||||||
(void)debuginfo;
|
|
||||||
|
|
||||||
as86_write();
|
as86_write();
|
||||||
saa_free(stext.data);
|
saa_free(stext.data);
|
||||||
while (stext.head) {
|
while (stext.head) {
|
||||||
|
@@ -220,7 +220,7 @@ static struct Section *create_section(char *name)
|
|||||||
return last_section;
|
return last_section;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void bin_cleanup(int debuginfo)
|
static void bin_cleanup(void)
|
||||||
{
|
{
|
||||||
struct Section *g, **gp;
|
struct Section *g, **gp;
|
||||||
struct Section *gs = NULL, **gsp;
|
struct Section *gs = NULL, **gsp;
|
||||||
@@ -232,8 +232,6 @@ static void bin_cleanup(int debuginfo)
|
|||||||
uint64_t pend;
|
uint64_t pend;
|
||||||
int h;
|
int h;
|
||||||
|
|
||||||
(void)debuginfo; /* placate optimizers */
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
nasm_error(ERR_DEBUG,
|
nasm_error(ERR_DEBUG,
|
||||||
"bin_cleanup: Sections were initially referenced in this order:\n");
|
"bin_cleanup: Sections were initially referenced in this order:\n");
|
||||||
|
@@ -223,12 +223,11 @@ static void coff_gen_init(void)
|
|||||||
def_seg = seg_alloc();
|
def_seg = seg_alloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void coff_cleanup(int debuginfo)
|
static void coff_cleanup(void)
|
||||||
{
|
{
|
||||||
struct coff_Reloc *r;
|
struct coff_Reloc *r;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (debuginfo && dfmt->cleanup)
|
|
||||||
dfmt->cleanup();
|
dfmt->cleanup();
|
||||||
|
|
||||||
coff_write();
|
coff_write();
|
||||||
|
@@ -63,9 +63,8 @@ static void dbg_init(void)
|
|||||||
fprintf(ofile, "NASM Output format debug dump\n");
|
fprintf(ofile, "NASM Output format debug dump\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void dbg_cleanup(int debuginfo)
|
static void dbg_cleanup(void)
|
||||||
{
|
{
|
||||||
(void)debuginfo;
|
|
||||||
dfmt->cleanup();
|
dfmt->cleanup();
|
||||||
while (dbgsect) {
|
while (dbgsect) {
|
||||||
struct Section *tmp = dbgsect;
|
struct Section *tmp = dbgsect;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -158,8 +158,6 @@ static struct elf_symbol *lastsym;
|
|||||||
|
|
||||||
/* common debugging routines */
|
/* common debugging routines */
|
||||||
static void debug_typevalue(int32_t);
|
static void debug_typevalue(int32_t);
|
||||||
static void debug_deflabel(char *, int32_t, int64_t, int, char *);
|
|
||||||
static void debug_directive(const char *, const char *);
|
|
||||||
|
|
||||||
/* stabs debugging routines */
|
/* stabs debugging routines */
|
||||||
static void stabs_linenum(const char *filename, int32_t linenumber, int32_t);
|
static void stabs_linenum(const char *filename, int32_t linenumber, int32_t);
|
||||||
@@ -218,13 +216,11 @@ static void elf_init(void)
|
|||||||
def_seg = seg_alloc();
|
def_seg = seg_alloc();
|
||||||
}
|
}
|
||||||
|
|
||||||
static void elf_cleanup(int debuginfo)
|
static void elf_cleanup(void)
|
||||||
{
|
{
|
||||||
struct elf_reloc *r;
|
struct elf_reloc *r;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
(void)debuginfo;
|
|
||||||
|
|
||||||
elf_write();
|
elf_write();
|
||||||
for (i = 0; i < nsects; i++) {
|
for (i = 0; i < nsects; i++) {
|
||||||
if (sects[i]->type != SHT_NOBITS)
|
if (sects[i]->type != SHT_NOBITS)
|
||||||
@@ -241,9 +237,7 @@ static void elf_cleanup(int debuginfo)
|
|||||||
saa_free(syms);
|
saa_free(syms);
|
||||||
raa_free(bsym);
|
raa_free(bsym);
|
||||||
saa_free(strs);
|
saa_free(strs);
|
||||||
if (dfmt) {
|
|
||||||
dfmt->cleanup();
|
dfmt->cleanup();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void add_sectname(char *firsthalf, char *secondhalf)
|
static void add_sectname(char *firsthalf, char *secondhalf)
|
||||||
@@ -692,12 +686,10 @@ static void elf_out(int32_t segto, const void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* again some stabs debugging stuff */
|
/* again some stabs debugging stuff */
|
||||||
if (dfmt) {
|
|
||||||
sinfo.offset = s->len;
|
sinfo.offset = s->len;
|
||||||
sinfo.section = i;
|
sinfo.section = i;
|
||||||
sinfo.name = s->name;
|
sinfo.name = s->name;
|
||||||
dfmt->debug_output(TY_STABSSYMLIN, &sinfo);
|
dfmt->debug_output(TY_STABSSYMLIN, &sinfo);
|
||||||
}
|
|
||||||
/* end of debugging stuff */
|
/* end of debugging stuff */
|
||||||
|
|
||||||
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
||||||
@@ -1340,8 +1332,8 @@ static const struct dfmt df_dwarf = {
|
|||||||
"dwarf",
|
"dwarf",
|
||||||
dwarf_init,
|
dwarf_init,
|
||||||
dwarf_linenum,
|
dwarf_linenum,
|
||||||
debug_deflabel,
|
null_debug_deflabel,
|
||||||
debug_directive,
|
null_debug_directive,
|
||||||
debug_typevalue,
|
debug_typevalue,
|
||||||
dwarf_output,
|
dwarf_output,
|
||||||
dwarf_cleanup
|
dwarf_cleanup
|
||||||
@@ -1351,8 +1343,8 @@ static const struct dfmt df_stabs = {
|
|||||||
"stabs",
|
"stabs",
|
||||||
null_debug_init,
|
null_debug_init,
|
||||||
stabs_linenum,
|
stabs_linenum,
|
||||||
debug_deflabel,
|
null_debug_deflabel,
|
||||||
debug_directive,
|
null_debug_directive,
|
||||||
debug_typevalue,
|
debug_typevalue,
|
||||||
stabs_output,
|
stabs_output,
|
||||||
stabs_cleanup
|
stabs_cleanup
|
||||||
@@ -1383,22 +1375,6 @@ const struct ofmt of_elf32 = {
|
|||||||
|
|
||||||
/* again, the stabs debugging stuff (code) */
|
/* again, the stabs debugging stuff (code) */
|
||||||
|
|
||||||
static void debug_deflabel(char *name, int32_t segment, int64_t offset, int is_global,
|
|
||||||
char *special)
|
|
||||||
{
|
|
||||||
(void)name;
|
|
||||||
(void)segment;
|
|
||||||
(void)offset;
|
|
||||||
(void)is_global;
|
|
||||||
(void)special;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_directive(const char *directive, const char *params)
|
|
||||||
{
|
|
||||||
(void)directive;
|
|
||||||
(void)params;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_typevalue(int32_t type)
|
static void debug_typevalue(int32_t type)
|
||||||
{
|
{
|
||||||
int32_t stype, ssize;
|
int32_t stype, ssize;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -160,8 +160,6 @@ static struct elf_symbol *lastsym;
|
|||||||
|
|
||||||
/* common debugging routines */
|
/* common debugging routines */
|
||||||
static void debug_typevalue(int32_t);
|
static void debug_typevalue(int32_t);
|
||||||
static void debug_deflabel(char *, int32_t, int64_t, int, char *);
|
|
||||||
static void debug_directive(const char *, const char *);
|
|
||||||
|
|
||||||
/* stabs debugging routines */
|
/* stabs debugging routines */
|
||||||
static void stabs_linenum(const char *filename, int32_t linenumber, int32_t);
|
static void stabs_linenum(const char *filename, int32_t linenumber, int32_t);
|
||||||
@@ -222,13 +220,11 @@ static void elf_init(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void elf_cleanup(int debuginfo)
|
static void elf_cleanup(void)
|
||||||
{
|
{
|
||||||
struct elf_reloc *r;
|
struct elf_reloc *r;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
(void)debuginfo;
|
|
||||||
|
|
||||||
elf_write();
|
elf_write();
|
||||||
for (i = 0; i < nsects; i++) {
|
for (i = 0; i < nsects; i++) {
|
||||||
if (sects[i]->type != SHT_NOBITS)
|
if (sects[i]->type != SHT_NOBITS)
|
||||||
@@ -245,9 +241,7 @@ static void elf_cleanup(int debuginfo)
|
|||||||
saa_free(syms);
|
saa_free(syms);
|
||||||
raa_free(bsym);
|
raa_free(bsym);
|
||||||
saa_free(strs);
|
saa_free(strs);
|
||||||
if (dfmt) {
|
|
||||||
dfmt->cleanup();
|
dfmt->cleanup();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add entry to the elf .shstrtab section */
|
/* add entry to the elf .shstrtab section */
|
||||||
@@ -708,13 +702,11 @@ static void elf_out(int32_t segto, const void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* again some stabs debugging stuff */
|
/* again some stabs debugging stuff */
|
||||||
if (dfmt) {
|
|
||||||
sinfo.offset = s->len;
|
sinfo.offset = s->len;
|
||||||
sinfo.section = i;
|
sinfo.section = i;
|
||||||
sinfo.segto = segto;
|
sinfo.segto = segto;
|
||||||
sinfo.name = s->name;
|
sinfo.name = s->name;
|
||||||
dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo);
|
dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo);
|
||||||
}
|
|
||||||
/* end of debugging stuff */
|
/* end of debugging stuff */
|
||||||
|
|
||||||
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
||||||
@@ -1430,8 +1422,8 @@ static const struct dfmt df_dwarf = {
|
|||||||
"dwarf",
|
"dwarf",
|
||||||
dwarf_init,
|
dwarf_init,
|
||||||
dwarf_linenum,
|
dwarf_linenum,
|
||||||
debug_deflabel,
|
null_debug_deflabel,
|
||||||
debug_directive,
|
null_debug_directive,
|
||||||
debug_typevalue,
|
debug_typevalue,
|
||||||
dwarf_output,
|
dwarf_output,
|
||||||
dwarf_cleanup
|
dwarf_cleanup
|
||||||
@@ -1441,8 +1433,8 @@ static const struct dfmt df_stabs = {
|
|||||||
"stabs",
|
"stabs",
|
||||||
null_debug_init,
|
null_debug_init,
|
||||||
stabs_linenum,
|
stabs_linenum,
|
||||||
debug_deflabel,
|
null_debug_deflabel,
|
||||||
debug_directive,
|
null_debug_directive,
|
||||||
debug_typevalue,
|
debug_typevalue,
|
||||||
stabs_output,
|
stabs_output,
|
||||||
stabs_cleanup
|
stabs_cleanup
|
||||||
@@ -1472,22 +1464,6 @@ const struct ofmt of_elf64 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* common debugging routines */
|
/* common debugging routines */
|
||||||
static void debug_deflabel(char *name, int32_t segment, int64_t offset,
|
|
||||||
int is_global, char *special)
|
|
||||||
{
|
|
||||||
(void)name;
|
|
||||||
(void)segment;
|
|
||||||
(void)offset;
|
|
||||||
(void)is_global;
|
|
||||||
(void)special;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_directive(const char *directive, const char *params)
|
|
||||||
{
|
|
||||||
(void)directive;
|
|
||||||
(void)params;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_typevalue(int32_t type)
|
static void debug_typevalue(int32_t type)
|
||||||
{
|
{
|
||||||
int32_t stype, ssize;
|
int32_t stype, ssize;
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -160,8 +160,6 @@ static struct elf_symbol *lastsym;
|
|||||||
|
|
||||||
/* common debugging routines */
|
/* common debugging routines */
|
||||||
static void debug_typevalue(int32_t);
|
static void debug_typevalue(int32_t);
|
||||||
static void debug_deflabel(char *, int32_t, int64_t, int, char *);
|
|
||||||
static void debug_directive(const char *, const char *);
|
|
||||||
|
|
||||||
/* stabs debugging routines */
|
/* stabs debugging routines */
|
||||||
static void stabs_linenum(const char *filename, int32_t linenumber, int32_t);
|
static void stabs_linenum(const char *filename, int32_t linenumber, int32_t);
|
||||||
@@ -222,13 +220,11 @@ static void elf_init(void)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void elf_cleanup(int debuginfo)
|
static void elf_cleanup(void)
|
||||||
{
|
{
|
||||||
struct elf_reloc *r;
|
struct elf_reloc *r;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
(void)debuginfo;
|
|
||||||
|
|
||||||
elf_write();
|
elf_write();
|
||||||
for (i = 0; i < nsects; i++) {
|
for (i = 0; i < nsects; i++) {
|
||||||
if (sects[i]->type != SHT_NOBITS)
|
if (sects[i]->type != SHT_NOBITS)
|
||||||
@@ -245,9 +241,7 @@ static void elf_cleanup(int debuginfo)
|
|||||||
saa_free(syms);
|
saa_free(syms);
|
||||||
raa_free(bsym);
|
raa_free(bsym);
|
||||||
saa_free(strs);
|
saa_free(strs);
|
||||||
if (dfmt) {
|
|
||||||
dfmt->cleanup();
|
dfmt->cleanup();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add entry to the elf .shstrtab section */
|
/* add entry to the elf .shstrtab section */
|
||||||
@@ -708,13 +702,11 @@ static void elf_out(int32_t segto, const void *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* again some stabs debugging stuff */
|
/* again some stabs debugging stuff */
|
||||||
if (dfmt) {
|
|
||||||
sinfo.offset = s->len;
|
sinfo.offset = s->len;
|
||||||
sinfo.section = i;
|
sinfo.section = i;
|
||||||
sinfo.segto = segto;
|
sinfo.segto = segto;
|
||||||
sinfo.name = s->name;
|
sinfo.name = s->name;
|
||||||
dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo);
|
dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo);
|
||||||
}
|
|
||||||
/* end of debugging stuff */
|
/* end of debugging stuff */
|
||||||
|
|
||||||
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
if (s->type == SHT_NOBITS && type != OUT_RESERVE) {
|
||||||
@@ -1390,8 +1382,8 @@ static const struct dfmt df_dwarf = {
|
|||||||
"dwarf",
|
"dwarf",
|
||||||
dwarf_init,
|
dwarf_init,
|
||||||
dwarf_linenum,
|
dwarf_linenum,
|
||||||
debug_deflabel,
|
null_debug_deflabel,
|
||||||
debug_directive,
|
null_debug_directive,
|
||||||
debug_typevalue,
|
debug_typevalue,
|
||||||
dwarf_output,
|
dwarf_output,
|
||||||
dwarf_cleanup
|
dwarf_cleanup
|
||||||
@@ -1401,8 +1393,8 @@ static const struct dfmt df_stabs = {
|
|||||||
"stabs",
|
"stabs",
|
||||||
null_debug_init,
|
null_debug_init,
|
||||||
stabs_linenum,
|
stabs_linenum,
|
||||||
debug_deflabel,
|
null_debug_deflabel,
|
||||||
debug_directive,
|
null_debug_directive,
|
||||||
debug_typevalue,
|
debug_typevalue,
|
||||||
stabs_output,
|
stabs_output,
|
||||||
stabs_cleanup
|
stabs_cleanup
|
||||||
@@ -1432,22 +1424,6 @@ const struct ofmt of_elfx32 = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* common debugging routines */
|
/* common debugging routines */
|
||||||
static void debug_deflabel(char *name, int32_t segment, int64_t offset,
|
|
||||||
int is_global, char *special)
|
|
||||||
{
|
|
||||||
(void)name;
|
|
||||||
(void)segment;
|
|
||||||
(void)offset;
|
|
||||||
(void)is_global;
|
|
||||||
(void)special;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_directive(const char *directive, const char *params)
|
|
||||||
{
|
|
||||||
(void)directive;
|
|
||||||
(void)params;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void debug_typevalue(int32_t type)
|
static void debug_typevalue(int32_t type)
|
||||||
{
|
{
|
||||||
int32_t stype, ssize;
|
int32_t stype, ssize;
|
||||||
|
@@ -374,6 +374,6 @@ const struct ofmt *ofmt_find(const char *name, const struct ofmt_alias **ofmt_al
|
|||||||
const struct dfmt *dfmt_find(const struct ofmt *, const char *);
|
const struct dfmt *dfmt_find(const struct ofmt *, const char *);
|
||||||
void ofmt_list(const struct ofmt *, FILE *);
|
void ofmt_list(const struct ofmt *, FILE *);
|
||||||
void dfmt_list(const struct ofmt *ofmt, FILE * fp);
|
void dfmt_list(const struct ofmt *ofmt, FILE * fp);
|
||||||
extern struct dfmt null_debug_form;
|
extern const struct dfmt null_debug_form;
|
||||||
|
|
||||||
#endif /* NASM_OUTFORM_H */
|
#endif /* NASM_OUTFORM_H */
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2013 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -185,13 +185,14 @@ static int32_t ieee_entry_seg, ieee_entry_ofs;
|
|||||||
static int checksum;
|
static int checksum;
|
||||||
|
|
||||||
extern const struct ofmt of_ieee;
|
extern const struct ofmt of_ieee;
|
||||||
|
static const struct dfmt ladsoft_debug_form;
|
||||||
|
|
||||||
static void ieee_data_new(struct ieeeSection *);
|
static void ieee_data_new(struct ieeeSection *);
|
||||||
static void ieee_write_fixup(int32_t, int32_t, struct ieeeSection *,
|
static void ieee_write_fixup(int32_t, int32_t, struct ieeeSection *,
|
||||||
int, uint64_t, int32_t);
|
int, uint64_t, int32_t);
|
||||||
static void ieee_install_fixup(struct ieeeSection *, struct ieeeFixupp *);
|
static void ieee_install_fixup(struct ieeeSection *, struct ieeeFixupp *);
|
||||||
static int32_t ieee_segment(char *, int, int *);
|
static int32_t ieee_segment(char *, int, int *);
|
||||||
static void ieee_write_file(int debuginfo);
|
static void ieee_write_file(void);
|
||||||
static void ieee_write_byte(struct ieeeSection *, int);
|
static void ieee_write_byte(struct ieeeSection *, int);
|
||||||
static void ieee_write_word(struct ieeeSection *, int);
|
static void ieee_write_word(struct ieeeSection *, int);
|
||||||
static void ieee_write_dword(struct ieeeSection *, int32_t);
|
static void ieee_write_dword(struct ieeeSection *, int32_t);
|
||||||
@@ -232,9 +233,9 @@ static int ieee_set_info(enum geninfo type, char **val)
|
|||||||
/*
|
/*
|
||||||
* Rundown
|
* Rundown
|
||||||
*/
|
*/
|
||||||
static void ieee_cleanup(int debuginfo)
|
static void ieee_cleanup(void)
|
||||||
{
|
{
|
||||||
ieee_write_file(debuginfo);
|
ieee_write_file();
|
||||||
dfmt->cleanup();
|
dfmt->cleanup();
|
||||||
while (seghead) {
|
while (seghead) {
|
||||||
struct ieeeSection *segtmp = seghead;
|
struct ieeeSection *segtmp = seghead;
|
||||||
@@ -305,7 +306,7 @@ static void ieee_deflabel(char *name, int32_t segment,
|
|||||||
* First check for the double-period, signifying something
|
* First check for the double-period, signifying something
|
||||||
* unusual.
|
* unusual.
|
||||||
*/
|
*/
|
||||||
if (name[0] == '.' && name[1] == '.') {
|
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
|
||||||
if (!strcmp(name, "..start")) {
|
if (!strcmp(name, "..start")) {
|
||||||
ieee_entry_seg = segment;
|
ieee_entry_seg = segment;
|
||||||
ieee_entry_ofs = offset;
|
ieee_entry_ofs = offset;
|
||||||
@@ -899,7 +900,7 @@ static void ieee_filename(char *inname, char *outname)
|
|||||||
standard_extension(inname, outname, ".o");
|
standard_extension(inname, outname, ".o");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ieee_write_file(int debuginfo)
|
static void ieee_write_file(void)
|
||||||
{
|
{
|
||||||
struct tm *thetime;
|
struct tm *thetime;
|
||||||
time_t reltime;
|
time_t reltime;
|
||||||
@@ -911,6 +912,7 @@ static void ieee_write_file(int debuginfo)
|
|||||||
struct ieeeFixupp *fix;
|
struct ieeeFixupp *fix;
|
||||||
struct Array *arr;
|
struct Array *arr;
|
||||||
int i;
|
int i;
|
||||||
|
const bool debuginfo = (dfmt == &ladsoft_debug_form);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the module header
|
* Write the module header
|
||||||
@@ -1397,20 +1399,16 @@ static void dbgls_deflabel(char *name, int32_t segment,
|
|||||||
/* Keep compiler from warning about special */
|
/* Keep compiler from warning about special */
|
||||||
(void)special;
|
(void)special;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: ..[^@] special symbols are filtered in labels.c
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's a special-retry from pass two, discard it.
|
* If it's a special-retry from pass two, discard it.
|
||||||
*/
|
*/
|
||||||
if (is_global == 3)
|
if (is_global == 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
* First check for the double-period, signifying something
|
|
||||||
* unusual.
|
|
||||||
*/
|
|
||||||
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Case (i):
|
* Case (i):
|
||||||
*/
|
*/
|
||||||
|
@@ -1543,14 +1543,12 @@ static void macho_write (void)
|
|||||||
for the object file, writing, and then freeing all of the data from
|
for the object file, writing, and then freeing all of the data from
|
||||||
the file. */
|
the file. */
|
||||||
|
|
||||||
static void macho_cleanup(int debuginfo)
|
static void macho_cleanup(void)
|
||||||
{
|
{
|
||||||
struct section *s;
|
struct section *s;
|
||||||
struct reloc *r;
|
struct reloc *r;
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
|
|
||||||
(void)debuginfo;
|
|
||||||
|
|
||||||
/* Sort all symbols. */
|
/* Sort all symbols. */
|
||||||
macho_layout_symbols (&nsyms, &strslen);
|
macho_layout_symbols (&nsyms, &strslen);
|
||||||
|
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/* ----------------------------------------------------------------------- *
|
/* ----------------------------------------------------------------------- *
|
||||||
*
|
*
|
||||||
* Copyright 1996-2014 The NASM Authors - All Rights Reserved
|
* Copyright 1996-2016 The NASM Authors - All Rights Reserved
|
||||||
* See the file AUTHORS included with the NASM distribution for
|
* See the file AUTHORS included with the NASM distribution for
|
||||||
* the specific copyright holders.
|
* the specific copyright holders.
|
||||||
*
|
*
|
||||||
@@ -625,12 +625,13 @@ static struct ExpDef {
|
|||||||
static int32_t obj_entry_seg, obj_entry_ofs;
|
static int32_t obj_entry_seg, obj_entry_ofs;
|
||||||
|
|
||||||
const struct ofmt of_obj;
|
const struct ofmt of_obj;
|
||||||
|
static const struct dfmt borland_debug_form;
|
||||||
|
|
||||||
/* The current segment */
|
/* The current segment */
|
||||||
static struct Segment *current_seg;
|
static struct Segment *current_seg;
|
||||||
|
|
||||||
static int32_t obj_segment(char *, int, int *);
|
static int32_t obj_segment(char *, int, int *);
|
||||||
static void obj_write_file(int debuginfo);
|
static void obj_write_file(void);
|
||||||
static int obj_directive(enum directives, char *, int);
|
static int obj_directive(enum directives, char *, int);
|
||||||
|
|
||||||
static void obj_init(void)
|
static void obj_init(void)
|
||||||
@@ -667,9 +668,10 @@ static int obj_set_info(enum geninfo type, char **val)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
static void obj_cleanup(int debuginfo)
|
|
||||||
|
static void obj_cleanup(void)
|
||||||
{
|
{
|
||||||
obj_write_file(debuginfo);
|
obj_write_file();
|
||||||
dfmt->cleanup();
|
dfmt->cleanup();
|
||||||
while (seghead) {
|
while (seghead) {
|
||||||
struct Segment *segtmp = seghead;
|
struct Segment *segtmp = seghead;
|
||||||
@@ -1916,7 +1918,7 @@ static void obj_filename(char *inname, char *outname)
|
|||||||
standard_extension(inname, outname, ".obj");
|
standard_extension(inname, outname, ".obj");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void obj_write_file(int debuginfo)
|
static void obj_write_file(void)
|
||||||
{
|
{
|
||||||
struct Segment *seg, *entry_seg_ptr = 0;
|
struct Segment *seg, *entry_seg_ptr = 0;
|
||||||
struct FileName *fn;
|
struct FileName *fn;
|
||||||
@@ -1928,6 +1930,7 @@ static void obj_write_file(int debuginfo)
|
|||||||
struct ExpDef *export;
|
struct ExpDef *export;
|
||||||
int lname_idx;
|
int lname_idx;
|
||||||
ObjRecord *orp;
|
ObjRecord *orp;
|
||||||
|
const bool debuginfo = (dfmt == &borland_debug_form);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Write the THEADR module header.
|
* Write the THEADR module header.
|
||||||
@@ -2499,20 +2502,16 @@ static void dbgbi_deflabel(char *name, int32_t segment,
|
|||||||
|
|
||||||
(void)special;
|
(void)special;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Note: ..[^@] special symbols are filtered in labels.c
|
||||||
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's a special-retry from pass two, discard it.
|
* If it's a special-retry from pass two, discard it.
|
||||||
*/
|
*/
|
||||||
if (is_global == 3)
|
if (is_global == 3)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
|
||||||
* First check for the double-period, signifying something
|
|
||||||
* unusual.
|
|
||||||
*/
|
|
||||||
if (name[0] == '.' && name[1] == '.' && name[2] != '@') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Case (i):
|
* Case (i):
|
||||||
*/
|
*/
|
||||||
|
@@ -657,14 +657,12 @@ static void rdf2_out(int32_t segto, const void *data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void rdf2_cleanup(int debuginfo)
|
static void rdf2_cleanup(void)
|
||||||
{
|
{
|
||||||
int32_t l;
|
int32_t l;
|
||||||
struct BSSRec bs;
|
struct BSSRec bs;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
(void)debuginfo;
|
|
||||||
|
|
||||||
/* should write imported & exported symbol declarations to header here */
|
/* should write imported & exported symbol declarations to header here */
|
||||||
|
|
||||||
/* generate the output file... */
|
/* generate the output file... */
|
||||||
|
@@ -6,3 +6,9 @@ a_struc:
|
|||||||
istruc A_STRUC
|
istruc A_STRUC
|
||||||
at A_STRUC._a, dw 1
|
at A_STRUC._a, dw 1
|
||||||
iend
|
iend
|
||||||
|
|
||||||
|
section .data
|
||||||
|
foo:
|
||||||
|
dd 0x11111111
|
||||||
|
.bar:
|
||||||
|
dd 0x22222222
|
||||||
|
Reference in New Issue
Block a user