diff options
author | H. Peter Anvin <hpa@zytor.com> | 2016-03-08 01:08:53 -0800 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2016-03-08 01:08:53 -0800 |
commit | 1917f45ec20fc6df405bcf2fcba5b1660e1b22d7 (patch) | |
tree | 931f409972f065959223a5d24eace8d1015fb05d | |
parent | 63c42f08f70450f4e8f6f95603758f6e9b2d84a7 (diff) | |
parent | 4bef68a84e1ddd2dad5ec895338bc4920c46a83b (diff) | |
download | nasm-1917f45ec20fc6df405bcf2fcba5b1660e1b22d7.tar.gz |
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>
-rw-r--r-- | Makefile.in | 2 | ||||
-rw-r--r-- | Mkfiles/msvc.mak | 7 | ||||
-rw-r--r-- | Mkfiles/netware.mak | 2 | ||||
-rw-r--r-- | Mkfiles/openwcom.mak | 2 | ||||
-rw-r--r-- | Mkfiles/owlinux.mak | 2 | ||||
-rw-r--r-- | doc/changes.src | 3 | ||||
-rw-r--r-- | doc/nasmdoc.src | 11 | ||||
-rw-r--r-- | labels.c | 52 | ||||
-rw-r--r-- | nasm.c | 38 | ||||
-rw-r--r-- | nasm.h | 4 | ||||
-rw-r--r-- | nasm.txt | 5 | ||||
-rw-r--r-- | output/codeview.c | 19 | ||||
-rw-r--r-- | output/outaout.c | 4 | ||||
-rw-r--r-- | output/outas86.c | 4 | ||||
-rw-r--r-- | output/outbin.c | 4 | ||||
-rw-r--r-- | output/outcoff.c | 5 | ||||
-rw-r--r-- | output/outdbg.c | 3 | ||||
-rw-r--r-- | output/outelf32.c | 46 | ||||
-rw-r--r-- | output/outelf64.c | 48 | ||||
-rw-r--r-- | output/outelfx32.c | 48 | ||||
-rw-r--r-- | output/outform.h | 2 | ||||
-rw-r--r-- | output/outieee.c | 24 | ||||
-rw-r--r-- | output/outmacho.c | 4 | ||||
-rw-r--r-- | output/outobj.c | 23 | ||||
-rw-r--r-- | output/outrdf2.c | 4 | ||||
-rw-r--r-- | test/cv8struc.asm | 6 | ||||
-rw-r--r-- | version | 2 |
27 files changed, 145 insertions, 229 deletions
diff --git a/Makefile.in b/Makefile.in index d3119994..44ceceb7 100644 --- a/Makefile.in +++ b/Makefile.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 \ nasm.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 config.h md5.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 \ opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h \ diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak index ae94ee20..133087dd 100644 --- a/Mkfiles/msvc.mak +++ b/Mkfiles/msvc.mak @@ -5,6 +5,9 @@ # # Make sure to put the appropriate directories in your PATH, in # 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 = . srcdir = . @@ -18,7 +21,7 @@ mandir = $(prefix)/man CFLAGS = /Od /Zi LDFLAGS = /DEBUG !ELSE -CFLAGS = /O2 /Ox /Oy +CFLAGS = /O2 !ENDIF 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 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 -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 \ 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 \ diff --git a/Mkfiles/netware.mak b/Mkfiles/netware.mak index 5d86b181..3d40c1c8 100644 --- a/Mkfiles/netware.mak +++ b/Mkfiles/netware.mak @@ -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 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 -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 \ 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 \ diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index e0428087..58e11883 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -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 & nasm.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 config.h md5.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 & opflags.h output/outform.h parser.h pptok.h preproc.h raa.h regs.h saa.h & diff --git a/Mkfiles/owlinux.mak b/Mkfiles/owlinux.mak index b3c91ffb..af7577d2 100644 --- a/Mkfiles/owlinux.mak +++ b/Mkfiles/owlinux.mak @@ -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 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 -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 \ 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 \ diff --git a/doc/changes.src b/doc/changes.src index 62ece40f..26c43b37 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -14,6 +14,9 @@ since 2007. \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. diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 23a273b3..55be9d97 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -3824,17 +3824,6 @@ variable, for example: \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} NASM defines a set of standard macros, which are already defined @@ -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 * the specific copyright holders. * @@ -127,6 +127,22 @@ char lprefix[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 * given label name. Creates a new one, if it isn't found, and if * `create' is true. @@ -260,17 +276,13 @@ void redefine_label(char *label, int32_t segment, int64_t offset, char *special, snprintf(xsymbol, slen, "%s%s%s", lprefix, lptr->defn.label, lpostfix); - ofmt->symdef(xsymbol, segment, offset, exi, - special ? special : lptr->defn.special); - dfmt->debug_deflabel(xsymbol, segment, offset, exi, - special ? special : lptr->defn.special); -/** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/ + out_symdef(xsymbol, segment, offset, exi, + special ? special : lptr->defn.special); + /** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/ } else { if ((lptr->defn.is_global & (GLOBAL_BIT | EXTERN_BIT)) != EXTERN_BIT) { - ofmt->symdef(lptr->defn.label, segment, offset, exi, - special ? special : lptr->defn.special); - dfmt->debug_deflabel(label, segment, offset, exi, - special ? special : lptr->defn.special); + out_symdef(lptr->defn.label, segment, offset, exi, + special ? special : lptr->defn.special); } } } /* if (pass0 == 1) */ @@ -325,17 +337,13 @@ void define_label(char *label, int32_t segment, int64_t offset, char *special, snprintf(xsymbol, slen, "%s%s%s", lprefix, lptr->defn.label, lpostfix); - ofmt->symdef(xsymbol, segment, offset, exi, - special ? special : lptr->defn.special); - dfmt->debug_deflabel(xsymbol, segment, offset, exi, - special ? special : lptr->defn.special); -/** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/ + out_symdef(xsymbol, segment, offset, exi, + special ? special : lptr->defn.special); + /** nasm_free(xsymbol); ! outobj.c stores the pointer; ouch!!! **/ } else { if ((lptr->defn.is_global & (GLOBAL_BIT | EXTERN_BIT)) != EXTERN_BIT) { - ofmt->symdef(lptr->defn.label, segment, offset, exi, - special ? special : lptr->defn.special); - dfmt->debug_deflabel(label, segment, offset, exi, - special ? special : lptr->defn.special); + out_symdef(lptr->defn.label, segment, offset, exi, + special ? special : lptr->defn.special); } } } /* if (pass0 == 1) */ @@ -369,10 +377,8 @@ void define_common(char *label, int32_t segment, int32_t size, char *special) if (pass0 == 0) return; - ofmt->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); + out_symdef(lptr->defn.label, segment, size, 2, + special ? special : lptr->defn.special); } void declare_as_global(char *label, char *special) @@ -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 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; int pass0, passn; int globalrel = 0; @@ -356,11 +358,21 @@ int main(int argc, char **argv) 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; - else if (!dfmt) + } else if (!debug_format) { + /* Default debug format for this backend */ 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) preproc->extra_stdmac(ofmt->stdmac); @@ -464,7 +476,7 @@ int main(int argc, char **argv) assemble_file(inname, depend_ptr); if (!terminate_after_phase) { - ofmt->cleanup(using_debug_info); + ofmt->cleanup(); cleanup_labels(); fflush(ofile); if (ferror(ofile)) @@ -664,7 +676,6 @@ static bool process_arg(char *p, char *q) "unrecognised output format `%s' - " "use -hf for a list", param); } - dfmt = NULL; break; case 'O': /* Optimization level */ @@ -742,14 +753,8 @@ static bool process_arg(char *p, char *q) break; 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; + debug_format = param; break; case 'X': /* specify error reporting format */ @@ -765,6 +770,8 @@ static bool process_arg(char *p, char *q) case 'g': using_debug_info = true; + if (p[2]) + debug_format = nasm_skip_spaces(p + 2); break; case 'h': @@ -773,8 +780,7 @@ static bool process_arg(char *p, char *q) "[-l listfile]\n" " [options...] [--] filename\n" " or nasm -v (or --v) for version info\n\n" - " -t assemble in SciTech TASM compatible mode\n" - " -g generate debug information in selected format\n"); + " -t assemble in SciTech TASM compatible mode\n"); printf (" -E (or -e) preprocess only (writes output to stdout by default)\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" " -Z<file> redirect error messages to file\n" " -s redirect error messages to stdout\n\n" + " -g generate debugging information\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" " -f format select an output format\n\n" " -l listfile write listing to a listfile\n\n" @@ -844,7 +844,7 @@ struct ofmt { * One thing the cleanup routine should always do is to close * 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 * 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, @@ -47,7 +47,10 @@ OPTIONS formats, use the *-y* option (for example *-felf -y*). *-g*:: - Causes *nasm* to generate debug information in selected format. + Causes *nasm* to generate debug information. + +*-g*'format':: + Equivalent to **-g -F**__ format__. *-h*:: Causes *nasm* to exit immediately, after giving a summary of its diff --git a/output/codeview.c b/output/codeview.c index 8492fdd3..a63fd633 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -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, int is_global, char *special) { - int ret; - size_t len; struct cv8_symbol *sym; struct coff_Section *s; @@ -214,21 +212,8 @@ static void cv8_deflabel(char *name, int32_t segment, int64_t offset, sym->size = 0; sym->typeindex = 0; - /* handle local labels */ - if (name[0] == '.' && name[1] != '.' && cv8_state.last_sym != NULL) { - 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; + sym->name = nasm_strdup(name); + cv8_state.symbol_lengths += strlen(sym->name) + 1; if (cv8_state.last_sym && cv8_state.last_sym->section == segment) cv8_state.last_sym->size = offset - cv8_state.last_sym->secrel; diff --git a/output/outaout.c b/output/outaout.c index be566e07..1ac7d5a1 100644 --- a/output/outaout.c +++ b/output/outaout.c @@ -211,12 +211,10 @@ static void aoutb_init(void) #endif -static void aout_cleanup(int debuginfo) +static void aout_cleanup(void) { struct Reloc *r; - (void)debuginfo; - aout_pad_sections(); aout_fixup_relocs(&stext); aout_fixup_relocs(&sdata); diff --git a/output/outas86.c b/output/outas86.c index 3dc17c30..920748c9 100644 --- a/output/outas86.c +++ b/output/outas86.c @@ -138,12 +138,10 @@ static void as86_init(void) as86_add_string(as86_module); } -static void as86_cleanup(int debuginfo) +static void as86_cleanup(void) { struct Piece *p; - (void)debuginfo; - as86_write(); saa_free(stext.data); while (stext.head) { diff --git a/output/outbin.c b/output/outbin.c index e4e4e1e1..2b70b3b5 100644 --- a/output/outbin.c +++ b/output/outbin.c @@ -220,7 +220,7 @@ static struct Section *create_section(char *name) return last_section; } -static void bin_cleanup(int debuginfo) +static void bin_cleanup(void) { struct Section *g, **gp; struct Section *gs = NULL, **gsp; @@ -232,8 +232,6 @@ static void bin_cleanup(int debuginfo) uint64_t pend; int h; - (void)debuginfo; /* placate optimizers */ - #ifdef DEBUG nasm_error(ERR_DEBUG, "bin_cleanup: Sections were initially referenced in this order:\n"); diff --git a/output/outcoff.c b/output/outcoff.c index 3265b617..13a556dd 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -223,13 +223,12 @@ static void coff_gen_init(void) def_seg = seg_alloc(); } -static void coff_cleanup(int debuginfo) +static void coff_cleanup(void) { struct coff_Reloc *r; int i; - if (debuginfo && dfmt->cleanup) - dfmt->cleanup(); + dfmt->cleanup(); coff_write(); for (i = 0; i < coff_nsects; i++) { diff --git a/output/outdbg.c b/output/outdbg.c index 60a3ad28..ef7f8a93 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -63,9 +63,8 @@ static void dbg_init(void) fprintf(ofile, "NASM Output format debug dump\n"); } -static void dbg_cleanup(int debuginfo) +static void dbg_cleanup(void) { - (void)debuginfo; dfmt->cleanup(); while (dbgsect) { struct Section *tmp = dbgsect; diff --git a/output/outelf32.c b/output/outelf32.c index 3944cd44..8dbdadd9 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -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 * the specific copyright holders. * @@ -158,8 +158,6 @@ static struct elf_symbol *lastsym; /* common debugging routines */ 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 */ 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(); } -static void elf_cleanup(int debuginfo) +static void elf_cleanup(void) { struct elf_reloc *r; int i; - (void)debuginfo; - elf_write(); for (i = 0; i < nsects; i++) { if (sects[i]->type != SHT_NOBITS) @@ -241,9 +237,7 @@ static void elf_cleanup(int debuginfo) saa_free(syms); raa_free(bsym); saa_free(strs); - if (dfmt) { - dfmt->cleanup(); - } + dfmt->cleanup(); } 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 */ - if (dfmt) { - sinfo.offset = s->len; - sinfo.section = i; - sinfo.name = s->name; - dfmt->debug_output(TY_STABSSYMLIN, &sinfo); - } + sinfo.offset = s->len; + sinfo.section = i; + sinfo.name = s->name; + dfmt->debug_output(TY_STABSSYMLIN, &sinfo); /* end of debugging stuff */ if (s->type == SHT_NOBITS && type != OUT_RESERVE) { @@ -1340,8 +1332,8 @@ static const struct dfmt df_dwarf = { "dwarf", dwarf_init, dwarf_linenum, - debug_deflabel, - debug_directive, + null_debug_deflabel, + null_debug_directive, debug_typevalue, dwarf_output, dwarf_cleanup @@ -1351,8 +1343,8 @@ static const struct dfmt df_stabs = { "stabs", null_debug_init, stabs_linenum, - debug_deflabel, - debug_directive, + null_debug_deflabel, + null_debug_directive, debug_typevalue, stabs_output, stabs_cleanup @@ -1383,22 +1375,6 @@ const struct ofmt of_elf32 = { /* 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) { int32_t stype, ssize; diff --git a/output/outelf64.c b/output/outelf64.c index a8cefe17..03e50369 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -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 * the specific copyright holders. * @@ -160,8 +160,6 @@ static struct elf_symbol *lastsym; /* common debugging routines */ 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 */ 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; int i; - (void)debuginfo; - elf_write(); for (i = 0; i < nsects; i++) { if (sects[i]->type != SHT_NOBITS) @@ -245,9 +241,7 @@ static void elf_cleanup(int debuginfo) saa_free(syms); raa_free(bsym); saa_free(strs); - if (dfmt) { - dfmt->cleanup(); - } + dfmt->cleanup(); } /* 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 */ - if (dfmt) { - sinfo.offset = s->len; - sinfo.section = i; - sinfo.segto = segto; - sinfo.name = s->name; - dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo); - } + sinfo.offset = s->len; + sinfo.section = i; + sinfo.segto = segto; + sinfo.name = s->name; + dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo); /* end of debugging stuff */ if (s->type == SHT_NOBITS && type != OUT_RESERVE) { @@ -1430,8 +1422,8 @@ static const struct dfmt df_dwarf = { "dwarf", dwarf_init, dwarf_linenum, - debug_deflabel, - debug_directive, + null_debug_deflabel, + null_debug_directive, debug_typevalue, dwarf_output, dwarf_cleanup @@ -1441,8 +1433,8 @@ static const struct dfmt df_stabs = { "stabs", null_debug_init, stabs_linenum, - debug_deflabel, - debug_directive, + null_debug_deflabel, + null_debug_directive, debug_typevalue, stabs_output, stabs_cleanup @@ -1472,22 +1464,6 @@ const struct ofmt of_elf64 = { }; /* 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) { int32_t stype, ssize; diff --git a/output/outelfx32.c b/output/outelfx32.c index 4dc795a9..a2a1e2a9 100644 --- a/output/outelfx32.c +++ b/output/outelfx32.c @@ -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 * the specific copyright holders. * @@ -160,8 +160,6 @@ static struct elf_symbol *lastsym; /* common debugging routines */ 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 */ 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; int i; - (void)debuginfo; - elf_write(); for (i = 0; i < nsects; i++) { if (sects[i]->type != SHT_NOBITS) @@ -245,9 +241,7 @@ static void elf_cleanup(int debuginfo) saa_free(syms); raa_free(bsym); saa_free(strs); - if (dfmt) { - dfmt->cleanup(); - } + dfmt->cleanup(); } /* 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 */ - if (dfmt) { - sinfo.offset = s->len; - sinfo.section = i; - sinfo.segto = segto; - sinfo.name = s->name; - dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo); - } + sinfo.offset = s->len; + sinfo.section = i; + sinfo.segto = segto; + sinfo.name = s->name; + dfmt->debug_output(TY_DEBUGSYMLIN, &sinfo); /* end of debugging stuff */ if (s->type == SHT_NOBITS && type != OUT_RESERVE) { @@ -1390,8 +1382,8 @@ static const struct dfmt df_dwarf = { "dwarf", dwarf_init, dwarf_linenum, - debug_deflabel, - debug_directive, + null_debug_deflabel, + null_debug_directive, debug_typevalue, dwarf_output, dwarf_cleanup @@ -1401,8 +1393,8 @@ static const struct dfmt df_stabs = { "stabs", null_debug_init, stabs_linenum, - debug_deflabel, - debug_directive, + null_debug_deflabel, + null_debug_directive, debug_typevalue, stabs_output, stabs_cleanup @@ -1432,22 +1424,6 @@ const struct ofmt of_elfx32 = { }; /* 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) { int32_t stype, ssize; diff --git a/output/outform.h b/output/outform.h index d2dfef5f..5d30d645 100644 --- a/output/outform.h +++ b/output/outform.h @@ -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 *); void ofmt_list(const struct ofmt *, FILE *); 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 */ diff --git a/output/outieee.c b/output/outieee.c index b460bbb3..a7c5aa73 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -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 * the specific copyright holders. * @@ -185,13 +185,14 @@ static int32_t ieee_entry_seg, ieee_entry_ofs; static int checksum; extern const struct ofmt of_ieee; +static const struct dfmt ladsoft_debug_form; static void ieee_data_new(struct ieeeSection *); static void ieee_write_fixup(int32_t, int32_t, struct ieeeSection *, int, uint64_t, int32_t); static void ieee_install_fixup(struct ieeeSection *, struct ieeeFixupp *); 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_word(struct ieeeSection *, int); static void ieee_write_dword(struct ieeeSection *, int32_t); @@ -232,9 +233,9 @@ static int ieee_set_info(enum geninfo type, char **val) /* * Rundown */ -static void ieee_cleanup(int debuginfo) +static void ieee_cleanup(void) { - ieee_write_file(debuginfo); + ieee_write_file(); dfmt->cleanup(); while (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 * unusual. */ - if (name[0] == '.' && name[1] == '.') { + if (name[0] == '.' && name[1] == '.' && name[2] != '@') { if (!strcmp(name, "..start")) { ieee_entry_seg = segment; ieee_entry_ofs = offset; @@ -899,7 +900,7 @@ static void ieee_filename(char *inname, char *outname) standard_extension(inname, outname, ".o"); } -static void ieee_write_file(int debuginfo) +static void ieee_write_file(void) { struct tm *thetime; time_t reltime; @@ -911,6 +912,7 @@ static void ieee_write_file(int debuginfo) struct ieeeFixupp *fix; struct Array *arr; int i; + const bool debuginfo = (dfmt == &ladsoft_debug_form); /* * Write the module header @@ -1398,18 +1400,14 @@ static void dbgls_deflabel(char *name, int32_t segment, (void)special; /* - * If it's a special-retry from pass two, discard it. + * Note: ..[^@] special symbols are filtered in labels.c */ - if (is_global == 3) - return; /* - * First check for the double-period, signifying something - * unusual. + * If it's a special-retry from pass two, discard it. */ - if (name[0] == '.' && name[1] == '.' && name[2] != '@') { + if (is_global == 3) return; - } /* * Case (i): diff --git a/output/outmacho.c b/output/outmacho.c index c4bdc015..5897469a 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1543,14 +1543,12 @@ static void macho_write (void) for the object file, writing, and then freeing all of the data from the file. */ -static void macho_cleanup(int debuginfo) +static void macho_cleanup(void) { struct section *s; struct reloc *r; struct symbol *sym; - (void)debuginfo; - /* Sort all symbols. */ macho_layout_symbols (&nsyms, &strslen); diff --git a/output/outobj.c b/output/outobj.c index 8eb5422b..e8fef6e5 100644 --- a/output/outobj.c +++ b/output/outobj.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 * the specific copyright holders. * @@ -625,12 +625,13 @@ static struct ExpDef { static int32_t obj_entry_seg, obj_entry_ofs; const struct ofmt of_obj; +static const struct dfmt borland_debug_form; /* The current segment */ static struct Segment *current_seg; 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 void obj_init(void) @@ -667,9 +668,10 @@ static int obj_set_info(enum geninfo type, char **val) return 0; } -static void obj_cleanup(int debuginfo) + +static void obj_cleanup(void) { - obj_write_file(debuginfo); + obj_write_file(); dfmt->cleanup(); while (seghead) { struct Segment *segtmp = seghead; @@ -1916,7 +1918,7 @@ static void obj_filename(char *inname, char *outname) 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 FileName *fn; @@ -1928,6 +1930,7 @@ static void obj_write_file(int debuginfo) struct ExpDef *export; int lname_idx; ObjRecord *orp; + const bool debuginfo = (dfmt == &borland_debug_form); /* * Write the THEADR module header. @@ -2500,18 +2503,14 @@ static void dbgbi_deflabel(char *name, int32_t segment, (void)special; /* - * If it's a special-retry from pass two, discard it. + * Note: ..[^@] special symbols are filtered in labels.c */ - if (is_global == 3) - return; /* - * First check for the double-period, signifying something - * unusual. + * If it's a special-retry from pass two, discard it. */ - if (name[0] == '.' && name[1] == '.' && name[2] != '@') { + if (is_global == 3) return; - } /* * Case (i): diff --git a/output/outrdf2.c b/output/outrdf2.c index a6003821..a427ebb1 100644 --- a/output/outrdf2.c +++ b/output/outrdf2.c @@ -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; struct BSSRec bs; int i; - (void)debuginfo; - /* should write imported & exported symbol declarations to header here */ /* generate the output file... */ diff --git a/test/cv8struc.asm b/test/cv8struc.asm index 83fce799..eac6d8bb 100644 --- a/test/cv8struc.asm +++ b/test/cv8struc.asm @@ -6,3 +6,9 @@ a_struc: istruc A_STRUC at A_STRUC._a, dw 1 iend + + section .data +foo: + dd 0x11111111 +.bar: + dd 0x22222222 @@ -1 +1 @@ -2.12.01rc1 +2.12.01rc2 |