You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(208) |
Jun
(43) |
Jul
|
Aug
(2) |
Sep
(17) |
Oct
|
Nov
(4) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
(11) |
Mar
(3) |
Apr
(2) |
May
|
Jun
(3) |
Jul
(29) |
Aug
(29) |
Sep
(48) |
Oct
|
Nov
|
Dec
(5) |
2004 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2005 |
Jan
(12) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(1) |
Jun
(2) |
Jul
|
Aug
|
Sep
(4) |
Oct
(3) |
Nov
(1) |
Dec
(2) |
2006 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
(2) |
Oct
(21) |
Nov
(25) |
Dec
(16) |
2007 |
Jan
(26) |
Feb
(26) |
Mar
(18) |
Apr
(51) |
May
(45) |
Jun
(26) |
Jul
(6) |
Aug
(85) |
Sep
(161) |
Oct
(111) |
Nov
(83) |
Dec
(18) |
2008 |
Jan
(31) |
Feb
(27) |
Mar
|
Apr
(16) |
May
(142) |
Jun
(136) |
Jul
(51) |
Aug
(21) |
Sep
(47) |
Oct
(428) |
Nov
(19) |
Dec
(6) |
2009 |
Jan
(11) |
Feb
(37) |
Mar
(17) |
Apr
(15) |
May
(13) |
Jun
(61) |
Jul
(127) |
Aug
(15) |
Sep
(22) |
Oct
(28) |
Nov
(37) |
Dec
(10) |
2010 |
Jan
(18) |
Feb
(22) |
Mar
(10) |
Apr
(41) |
May
|
Jun
(48) |
Jul
(61) |
Aug
(54) |
Sep
(34) |
Oct
(15) |
Nov
(49) |
Dec
(11) |
2011 |
Jan
|
Feb
(24) |
Mar
(10) |
Apr
(9) |
May
|
Jun
(33) |
Jul
(41) |
Aug
(20) |
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
(86) |
Mar
(12) |
Apr
|
May
(10) |
Jun
|
Jul
(9) |
Aug
(4) |
Sep
(11) |
Oct
(3) |
Nov
(3) |
Dec
(10) |
2013 |
Jan
(1) |
Feb
(23) |
Mar
(15) |
Apr
(7) |
May
(20) |
Jun
(3) |
Jul
(15) |
Aug
|
Sep
(29) |
Oct
(16) |
Nov
(69) |
Dec
(18) |
2014 |
Jan
|
Feb
(8) |
Mar
|
Apr
|
May
(16) |
Jun
(7) |
Jul
|
Aug
(5) |
Sep
(2) |
Oct
(4) |
Nov
(25) |
Dec
(8) |
2015 |
Jan
(6) |
Feb
(6) |
Mar
|
Apr
(1) |
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
(1) |
Nov
(6) |
Dec
|
2016 |
Jan
(12) |
Feb
(97) |
Mar
(57) |
Apr
(52) |
May
(33) |
Jun
(1) |
Jul
(1) |
Aug
|
Sep
|
Oct
(3) |
Nov
(3) |
Dec
|
2017 |
Jan
(4) |
Feb
|
Mar
(23) |
Apr
(5) |
May
|
Jun
(2) |
Jul
(3) |
Aug
(2) |
Sep
|
Oct
(6) |
Nov
(3) |
Dec
(3) |
2018 |
Jan
(4) |
Feb
(11) |
Mar
|
Apr
(1) |
May
(3) |
Jun
(6) |
Jul
|
Aug
(5) |
Sep
(5) |
Oct
(36) |
Nov
(128) |
Dec
(18) |
2019 |
Jan
|
Feb
|
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(24) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: nasm-bot f. C. G. <gor...@gm...> - 2016-06-19 09:21:48
|
Commit-ID: bbb7a1aad9bc5e13ab5c2268bc318a94b796eed2 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=bbb7a1aad9bc5e13ab5c2268bc318a94b796eed2 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 19 Jun 2016 12:15:24 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 19 Jun 2016 12:15:24 +0300 preproc: Fix accessing OOM address In case if there is no environment variable present we allocated empty string but when working with tokens we test for second byte for special symbols, accessing out of memory address (->text[1] for the reference). http://bugzilla.nasm.us/show_bug.cgi?id=3392333 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- preproc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/preproc.c b/preproc.c index 8400773..fdb9fc1 100644 --- a/preproc.c +++ b/preproc.c @@ -1269,9 +1269,13 @@ static char *detoken(Token * tlist, bool expand_locals) if (!p) { nasm_error(ERR_NONFATAL | ERR_PASS1, "nonexistent environment variable `%s'", v); - p = ""; - } - t->text = nasm_strdup(p); + /* + * FIXME We better should investigate if accessing + * ->text[1] without ->text[0] is safe enough. + */ + t->text = nasm_zalloc(2); + } else + t->text = nasm_strdup(p); } nasm_free(q); } |
From: nasm-bot f. J. K. <jam...@li...> - 2016-05-17 19:09:17
|
Commit-ID: f8259c662a8e84195db6d80081936d6c7cf5e17d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=f8259c662a8e84195db6d80081936d6c7cf5e17d Author: Jim Kukunas <jam...@li...> AuthorDate: Mon, 16 May 2016 16:15:44 -0400 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 17 May 2016 11:35:44 -0700 codeview.c: Add support for multiple source files Handle the existence of multiple source files, as is normal when using include files. Signed-of-by: Jim Kukunas <jam...@li...> Signed-off-by: H. Peter Anvin <hp...@li...> --- output/codeview.c | 154 ++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 120 insertions(+), 34 deletions(-) diff --git a/output/codeview.c b/output/codeview.c index 84abd7d..d490fa4 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -74,8 +74,20 @@ struct dfmt df_cv8 = { /******************************************************************************* * dfmt callbacks ******************************************************************************/ +struct source_file; + struct source_file { char *name; + uint32_t namelen; + + struct source_file *next; + + uint32_t filetbl_off; + uint32_t sourcetbl_off; + + struct SAA *lines; + uint32_t num_lines; + unsigned char md5sum[MD5_HASHBYTES]; }; @@ -125,9 +137,10 @@ struct cv8_state { uint32_t text_offset; struct source_file source_file; + unsigned num_files; + uint32_t total_filename_len; - struct SAA *lines; - uint32_t num_lines; + unsigned total_lines; struct SAA *symbols; struct cv8_symbol *last_sym; @@ -151,8 +164,13 @@ static void cv8_init(void) cv8_state.text_offset = 0; - cv8_state.lines = saa_init(sizeof(struct linepair)); - cv8_state.num_lines = 0; + cv8_state.source_file.name = NULL; + cv8_state.source_file.next = NULL; + + cv8_state.num_files = 0; + cv8_state.total_filename_len = 0; + + cv8_state.total_lines = 0; cv8_state.symbols = saa_init(sizeof(struct cv8_symbol)); cv8_state.last_sym = NULL; @@ -160,7 +178,7 @@ static void cv8_init(void) cv8_state.cwd = nasm_realpath("."); } -static void register_file(const char *filename); +static struct source_file *register_file(const char *filename); static struct coff_Section *find_section(int32_t segto); static void cv8_linenum(const char *filename, int32_t linenumber, @@ -168,6 +186,7 @@ static void cv8_linenum(const char *filename, int32_t linenumber, { struct coff_Section *s; struct linepair *li; + struct source_file *file; s = find_section(segto); if (s == NULL) @@ -176,14 +195,14 @@ static void cv8_linenum(const char *filename, int32_t linenumber, if ((s->flags & IMAGE_SCN_MEM_EXECUTE) == 0) return; - if (cv8_state.source_file.name == NULL) - register_file(filename); + file = register_file(filename); - li = saa_wstruct(cv8_state.lines); + li = saa_wstruct(file->lines); li->file_offset = cv8_state.text_offset; li->linenumber = linenumber; - cv8_state.num_lines++; + file->num_lines++; + cv8_state.total_lines++; } static void cv8_deflabel(char *name, int32_t segment, int64_t offset, @@ -277,6 +296,7 @@ static void build_type_table(struct coff_Section *const sect); static void cv8_cleanup(void) { struct cv8_symbol *sym; + struct source_file *file; struct coff_Section *symbol_sect = coff_sects[cv8_state.symbol_sect]; struct coff_Section *type_sect = coff_sects[cv8_state.type_sect]; @@ -284,8 +304,16 @@ static void cv8_cleanup(void) build_symbol_table(symbol_sect); build_type_table(type_sect); - if (cv8_state.source_file.name != NULL) + if (cv8_state.source_file.name) { nasm_free(cv8_state.source_file.name); + saa_free(cv8_state.source_file.lines); + } + + list_for_each(file, cv8_state.source_file.next) { + nasm_free(file->name); + saa_free(file->lines); + free(file); + } if (cv8_state.cwd != NULL) nasm_free(cv8_state.cwd); @@ -339,11 +367,40 @@ done: return; } -static void register_file(const char *filename) +static struct source_file *register_file(const char *filename) { - cv8_state.source_file.name = nasm_realpath(filename); - memset(cv8_state.source_file.md5sum, 0, MD5_HASHBYTES); - calc_md5(filename, cv8_state.source_file.md5sum); + struct source_file *file; + + char *fullpath = nasm_realpath(filename); + + for (file = &cv8_state.source_file; file != NULL; file = file->next) { + if (file->name != NULL && !strcmp(file->name, fullpath)) { + free(fullpath); + return file; + } + } + + if (cv8_state.source_file.name == NULL) { + file = &cv8_state.source_file; + } else { + struct source_file *next; + file = nasm_malloc(sizeof(struct source_file)); + for (next = &cv8_state.source_file; next->next != NULL; next = next->next) {} + next->next = file; + } + + memset(file, 0, sizeof(struct source_file)); + + file->name = fullpath; + file->namelen = strlen(fullpath); + file->lines = saa_init(sizeof(struct linepair)); + file->next = NULL; + calc_md5(fullpath, file->md5sum); + + cv8_state.num_files++; + cv8_state.total_filename_len += file->namelen + 1; + + return file; } static struct coff_Section *find_section(int32_t segto) @@ -433,40 +490,63 @@ static inline void section_wbytes(struct coff_Section *sect, const void *buf, static void write_filename_table(struct coff_Section *const sect) { - uint32_t field_length = 0; - size_t filename_len = strlen(cv8_state.source_file.name); + uint32_t field_length; + uint32_t tbl_off = 1; /* offset starts at 1 to skip NULL entry */ + struct source_file *file; - field_length = 1 + filename_len + 1; + nasm_assert(cv8_state.source_file.name != NULL); + nasm_assert(cv8_state.num_files > 0); + nasm_assert(cv8_state.total_filename_len > 0); + + field_length = 1 + cv8_state.total_filename_len; section_write32(sect, 0x000000F3); section_write32(sect, field_length); section_write8(sect, 0); - section_wbytes(sect, cv8_state.source_file.name, filename_len + 1); + + for (file = &cv8_state.source_file; file != NULL; file = file->next) { + section_wbytes(sect, file->name, file->namelen + 1); + file->filetbl_off = tbl_off; + tbl_off += file->namelen + 1; + } } static void write_sourcefile_table(struct coff_Section *const sect) { + const uint32_t entry_size = 4 + 2 + MD5_HASHBYTES + 2; + uint32_t field_length = 0; + uint32_t tbl_off = 0; + struct source_file *file; - field_length = 4 + 2 + MD5_HASHBYTES + 2; + field_length = entry_size * cv8_state.num_files; section_write32(sect, 0x000000F4); section_write32(sect, field_length); - section_write32(sect, 1); /* offset of filename in filename str table */ - section_write16(sect, 0x0110); - section_wbytes(sect, cv8_state.source_file.md5sum, MD5_HASHBYTES); - section_write16(sect, 0); + for (file = &cv8_state.source_file; file != NULL; file = file->next) { + nasm_assert(file->filetbl_off > 0); + section_write32(sect, file->filetbl_off); + section_write16(sect, 0x0110); + section_wbytes(sect, file->md5sum, MD5_HASHBYTES); + section_write16(sect, 0); + + file->sourcetbl_off = tbl_off; + tbl_off += entry_size; + } } static void write_linenumber_table(struct coff_Section *const sect) { + const uint32_t file_field_len = 12; + const uint32_t line_field_len = 8; + int i; uint32_t field_length = 0; size_t field_base; + struct source_file *file; struct coff_Section *s; - struct linepair *li; for (i = 0; i < coff_nsects; i++) { if (!strncmp(coff_sects[i]->name, ".text", 5)) @@ -477,7 +557,9 @@ static void write_linenumber_table(struct coff_Section *const sect) return; s = coff_sects[i]; - field_length = 12 + 12 + (cv8_state.num_lines * 8); + field_length = 12; + field_length += (cv8_state.num_files * file_field_len); + field_length += (cv8_state.total_lines * line_field_len); section_write32(sect, 0x000000F2); section_write32(sect, field_length); @@ -494,16 +576,20 @@ static void write_linenumber_table(struct coff_Section *const sect) register_reloc(sect, ".text", field_base + 4, win64 ? IMAGE_REL_AMD64_SECTION : IMAGE_REL_I386_SECTION); - /* 1 or more source mappings (we assume only 1) */ - section_write32(sect, 0); - section_write32(sect, cv8_state.num_lines); - section_write32(sect, 12 + (cv8_state.num_lines * 8)); + for (file = &cv8_state.source_file; file != NULL; file = file->next) { + struct linepair *li; - /* the pairs */ - saa_rewind(cv8_state.lines); - while ((li = saa_rstruct(cv8_state.lines))) { - section_write32(sect, li->file_offset); - section_write32(sect, li->linenumber |= 0x80000000); + /* source mapping */ + section_write32(sect, file->sourcetbl_off); + section_write32(sect, file->num_lines); + section_write32(sect, file_field_len + (file->num_lines * line_field_len)); + + /* the pairs */ + saa_rewind(file->lines); + while ((li = saa_rstruct(file->lines))) { + section_write32(sect, li->file_offset); + section_write32(sect, li->linenumber |= 0x80000000); + } } } |
From: nasm-bot f. J. K. <jam...@li...> - 2016-05-17 19:09:17
|
Commit-ID: 4de0e936779a094b685c7ef959274687cf838fbe Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=4de0e936779a094b685c7ef959274687cf838fbe Author: Jim Kukunas <jam...@li...> AuthorDate: Mon, 16 May 2016 16:15:45 -0400 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 17 May 2016 11:35:44 -0700 codeview.c: register all filenames This essentially reverts 6503051dcc360172c49311d586f2b9cf4ab2ea81 since that workaround is no longer needed thanks to support for multiple source files Signed-off-by: Jim Kukunas <jam...@li...> Signed-off-by: H. Peter Anvin <hp...@li...> --- output/codeview.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/output/codeview.c b/output/codeview.c index d490fa4..9bafa16 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -188,6 +188,8 @@ static void cv8_linenum(const char *filename, int32_t linenumber, struct linepair *li; struct source_file *file; + file = register_file(filename); + s = find_section(segto); if (s == NULL) return; @@ -195,8 +197,6 @@ static void cv8_linenum(const char *filename, int32_t linenumber, if ((s->flags & IMAGE_SCN_MEM_EXECUTE) == 0) return; - file = register_file(filename); - li = saa_wstruct(file->lines); li->file_offset = cv8_state.text_offset; li->linenumber = linenumber; |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-05-17 04:39:18
|
Commit-ID: c9fd7b2aa5086205a626f8312bbaa5043b72a6d7 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c9fd7b2aa5086205a626f8312bbaa5043b72a6d7 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Mon, 16 May 2016 21:35:48 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Mon, 16 May 2016 21:35:48 -0700 configure: correctly discover -W options for clang clang doesn't error out on unknown -W options unless -Werror=unknown-warning-option is specified first, so do that so the configure script can do its job. Signed-off-by: H. Peter Anvin <hp...@zy...> --- configure.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure.in b/configure.in index 56e0ce6..61a9f7b 100644 --- a/configure.in +++ b/configure.in @@ -183,6 +183,10 @@ AC_ARG_ENABLE([ccache], []) PA_ADD_CFLAGS([-pedantic]) +dnl LLVM doesn't error out on invalid -W options unless this option is +dnl specified first. Enable this so this script can actually discover +dnl which -W options are possible for this compiler. +PA_ADD_CFLAGS([-Werror=unknown-warning-option]) dnl Suppress format warning on Windows targets due to their <inttypes.h> PA_ADD_CFLAGS([-Wpedantic-ms-format],[-Wno-pedantic-ms-format]) PA_ADD_CFLAGS([-Wc90-c99-compat]) |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-17 04:18:17
|
Commit-ID: 2c9b6ad3d9da2e57e695fd4ae2d612bd83aecaf4 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=2c9b6ad3d9da2e57e695fd4ae2d612bd83aecaf4 Author: H. Peter Anvin <hp...@li...> AuthorDate: Fri, 13 May 2016 14:42:55 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Fri, 13 May 2016 14:42:55 -0700 Support EVEX encodings of maps 0-15 Treat bits [3:0] of EVEX byte 0 as opcode map bits. Check the range of opcode maps in insns.pl: 0-31 for VEX, 8-31 for XOP, 0-15 for EVEX. Signed-off-by: H. Peter Anvin <hp...@li...> --- assemble.c | 6 +++--- insns.pl | 20 ++++++++++++++------ nasm.h | 2 +- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/assemble.c b/assemble.c index 0fe323c..054e947 100644 --- a/assemble.c +++ b/assemble.c @@ -81,8 +81,8 @@ * * EVEX prefixes are followed by the sequence: * \cm\wlp\tup where cm is: - * cc 000 0mm - * c = 2 for EVEX and m is the legacy escape (0f, 0f38, 0f3a) + * cc 00m mmm + * c = 2 for EVEX and mmmm is the M field (EVEX.P0[3:0]) * and wlp is: * 00 wwl lpp * [l0] ll = 0 (.128, .lz) @@ -1662,7 +1662,7 @@ static void gencode(int32_t segment, int64_t offset, int bits, /* EVEX.X can be set by either REX or EVEX for different reasons */ bytes[1] = ((((ins->rex & 7) << 5) | (ins->evex_p[0] & (EVEX_P0X | EVEX_P0RP))) ^ 0xf0) | - (ins->vex_cm & 3); + (ins->vex_cm & EVEX_P0MM); bytes[2] = ((ins->rex & REX_W) << (7 - 3)) | ((~ins->vexreg & 15) << 3) | (1 << 2) | (ins->vex_wlp & 3); diff --git a/insns.pl b/insns.pl index 2504981..258c023 100755 --- a/insns.pl +++ b/insns.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ## -------------------------------------------------------------------------- ## -## 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. ## @@ -864,7 +864,8 @@ sub byte_code_compile($$) { push(@codes, 0200 + (($oppos{'m'} & 3) << 3) + $1); $prefix_ok = 0; } elsif ($op =~ /^(vex|xop)(|\..*)$/) { - my $c = $vexmap{$1}; + my $vexname = $1; + my $c = $vexmap{$vexname}; my ($m,$w,$l,$p) = (undef,2,undef,0); my $has_nds = 0; my @subops = split(/\./, $op); @@ -902,19 +903,23 @@ sub byte_code_compile($$) { $m = $1+0; } elsif ($oq eq 'nds' || $oq eq 'ndd' || $oq eq 'dds') { if (!defined($oppos{'v'})) { - die "$fname: $line: vex.$oq without 'v' operand\n"; + die "$fname: $line: $vexname.$oq without 'v' operand\n"; } $has_nds = 1; } else { - die "$fname: $line: undefined VEX subcode: $oq\n"; + die "$fname: $line: undefined \U$vexname\E subcode: $oq\n"; } } if (!defined($m) || !defined($w) || !defined($l) || !defined($p)) { - die "$fname: $line: missing fields in VEX specification\n"; + die "$fname: $line: missing fields in \U$vexname\E specification\n"; } if (defined($oppos{'v'}) && !$has_nds) { - die "$fname: $line: 'v' operand without vex.nds or vex.ndd\n"; + die "$fname: $line: 'v' operand without ${vexname}.nds or ${vexname}.ndd\n"; } + my $minmap = ($c == 1) ? 8 : 0; # 0-31 for VEX, 8-31 for XOP + if ($m < $minmap || $m > 31) { + die "$fname: $line: Only maps ${minmap}-31 are valid for \U${vexname}\n"; + } push(@codes, defined($oppos{'v'}) ? 0260+($oppos{'v'} & 3) : 0270, ($c << 6)+$m, ($w << 4)+($l << 2)+$p); $prefix_ok = 0; @@ -970,6 +975,9 @@ sub byte_code_compile($$) { if (defined($oppos{'v'}) && !$has_nds) { die "$fname: $line: 'v' operand without evex.nds or evex.ndd\n"; } + if ($m > 15) { + die "$fname: $line: Only maps 0-15 are valid for EVEX\n"; + } push(@codes, defined($oppos{'v'}) ? 0240+($oppos{'v'} & 3) : 0250, ($c << 6)+$m, ($w << 4)+($l << 2)+$p, $tup); $prefix_ok = 0; diff --git a/nasm.h b/nasm.h index cfb1295..5f99355 100644 --- a/nasm.h +++ b/nasm.h @@ -451,7 +451,7 @@ static inline uint8_t get_cond_opcode(enum ccode c) /* * EVEX bit field */ -#define EVEX_P0MM 0x03 /* EVEX P[1:0] : Legacy escape */ +#define EVEX_P0MM 0x0f /* EVEX P[3:0] : Opcode map */ #define EVEX_P0RP 0x10 /* EVEX P[4] : High-16 reg */ #define EVEX_P0X 0x40 /* EVEX P[6] : High-16 rm */ #define EVEX_P1PP 0x03 /* EVEX P[9:8] : Legacy prefix */ |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-17 04:18:16
|
Commit-ID: c0aaf9750f1d75e5472e9ce2e7b6a64133eb8f73 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c0aaf9750f1d75e5472e9ce2e7b6a64133eb8f73 Author: H. Peter Anvin <hp...@li...> AuthorDate: Tue, 10 May 2016 15:18:00 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 10 May 2016 15:18:00 -0700 Revert "nasmlib/file.c: Windows _chsize_s() *returns* errno" This reverts commit 55e51d9534a547c7bd4148d952b317884991078e. First of all, _chsize_s() *does* set errno, even though it returns the same value. Second of all, all we look for is a zero return value anyway, so there is no need for this wrapper. Signed-off-by: H. Peter Anvin <hp...@li...> --- nasmlib/file.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/nasmlib/file.c b/nasmlib/file.c index ce22ea3..6ba3844 100644 --- a/nasmlib/file.c +++ b/nasmlib/file.c @@ -60,17 +60,7 @@ /* Can we adjust the file size without actually writing all the bytes? */ #ifdef HAVE_FILENO /* Useless without fileno() */ # ifdef HAVE__CHSIZE_S -static int nasm_ftruncate(int fd, int64_t size) -{ - int err = _chsize_s(fd, size); - - if (!err) - return 0; - - errno = err; - return -1; -} -# define nasm_ftruncate(fd,size) nasm_ftruncate(fd,size) +# define nasm_ftruncate(fd,size) _chsize_s(fd,size) # elif defined(HAVE__CHSIZE) # define nasm_ftruncate(fd,size) _chsize(fd,size) # elif defined(HAVE_FTRUNCATE) |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-17 03:42:18
|
Commit-ID: acbf8f0e1972eb690c91c5bca5b8c1c960dde4b5 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=acbf8f0e1972eb690c91c5bca5b8c1c960dde4b5 Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 16 May 2016 20:39:04 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 16 May 2016 20:39:04 -0700 doc: remove obsolete references We don't use comp.lang.asm.x86 or freshmeat for announements anymore. Signed-off-by: H. Peter Anvin <hp...@li...> --- doc/nasmdoc.src | 5 ----- 1 file changed, 5 deletions(-) diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index e41c086..fb7a944 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -386,11 +386,6 @@ google for us! development}\i{daily development snapshots} of NASM are available from the official web site. -Announcements are posted to -\W{news:comp.lang.asm.x86}\i\c{comp.lang.asm.x86}, -and to the web site -\W{http://www.freshmeat.net/}\c{http://www.freshmeat.net/}. - If you want information about the current development status, please subscribe to the \i\c{nasm-devel} email list; see link from the website. |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-17 03:33:21
|
Commit-ID: 407166001c2df8ef32aae708ff797b069a0d398b Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=407166001c2df8ef32aae708ff797b069a0d398b Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 16 May 2016 20:30:09 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 16 May 2016 20:30:09 -0700 Fix building in a separate directory from the source code The code to handle building in a separate directory had seriously bitrotted. This contains a number of fixes to make it possible, including bits like the documentation which never worked in the past. Signed-off-by: H. Peter Anvin <hp...@li...> --- .gitignore | 3 ++- Makefile.in | 7 ++++-- doc/Makefile.in | 30 +++++++++++++++---------- doc/genps.pl | 13 ++++++----- doc/genpsdriver.pl | 64 ------------------------------------------------------ doc/nasmdoc.src | 5 ++++- doc/rdsrc.pl | 50 ++++++++++++++++++++++++++++++------------ nsis/nasm.nsi | 38 +++++++++++++++++--------------- version.pl | 5 ++++- 9 files changed, 98 insertions(+), 117 deletions(-) diff --git a/.gitignore b/.gitignore index 83236c5..dc2879f 100644 --- a/.gitignore +++ b/.gitignore @@ -39,6 +39,7 @@ TAGS /doc/*.txt /doc/Makefile /doc/inslist.src +/doc/version.src /doc/html /doc/info /insnsa.c @@ -52,7 +53,7 @@ TAGS /nasm.1 /ndisasm /ndisasm.man -/nasm.1 +/ndisasm.1 /pptok.c /pptok.h /pptok.ph diff --git a/Makefile.in b/Makefile.in index 13b10ce..05f36cc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -8,6 +8,7 @@ top_srcdir = @top_srcdir@ srcdir = @srcdir@ +objdir = @builddir@ VPATH = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -205,9 +206,11 @@ perlreq: $(PERLREQ) nsis/arch.nsh: nsis/getpearch.pl nasm$(X) $(PERL) $(srcdir)/nsis/getpearch.pl nasm$(X) > nsis/arch.nsh -# Should only be done after "make everything" +# Should only be done after "make everything". +# The use of redirection here keeps makensis from moving the cwd to the +# source directory. nsis: nsis/nasm.nsi nsis/arch.nsh nsis/version.nsh - $(MAKENSIS) nsis/nasm.nsi + $(MAKENSIS) -Dsrcdir="$(srcdir)" -Dobjdir="$(objdir)" - < "$<" # Generated manpages, also pregenerated for distribution manpages: nasm.1 ndisasm.1 diff --git a/doc/Makefile.in b/doc/Makefile.in index 4932869..dc81fb1 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -2,6 +2,7 @@ # UNIX Makefile for NASM documentation # +top_srcdir = @top_srcdir@ srcdir = @srcdir@ VPATH = @srcdir@ prefix = @prefix@ @@ -16,7 +17,7 @@ INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ -PERL = perl +PERL = perl -I$(srcdir) MAKEINFO = makeinfo TEXI2DVI = texi2dvi TEXI2IPF = texi2ipf @@ -26,7 +27,7 @@ ACRODIST = @ACRODIST@ # Acrobat Distiller PSTOPDF = @PSTOPDF@ # BSD/MacOS X utility PS2PDF = @PS2PDF@ # Part of GhostScript -SRCS = nasmdoc.src inslist.src changes.src +SRCS = nasmdoc.src inslist.src changes.src version.src OUT = info html nasmdoc.txt nasmdoc.ps nasmdoc.pdf # exports @@ -38,28 +39,35 @@ all: $(OUT) os2: nasm.inf inslist.src: inslist.pl ../insns.dat - $(PERL) $(srcdir)/inslist.pl + $(PERL) $(srcdir)/inslist.pl $(srcdir)/../insns.dat .PHONY: html html: html/nasmdoc0.html +RDSRC = $(PERL) $(srcdir)/rdsrc.pl -I$(srcdir)/ + html/nasmdoc0.html: $(SRCS) rdsrc.pl mkdir -p html - $(PERL) $(srcdir)/rdsrc.pl html < $< + $(RDSRC) html "$<" mv -f *.html html nasmdoc.dip: $(SRCS) rdsrc.pl - $(PERL) $(srcdir)/rdsrc.pl dip < $< + $(RDSRC) dip "$<" nasmdoc.texi: $(SRCS) rdsrc.pl - $(PERL) $(srcdir)/rdsrc.pl texi < $< + $(RDSRC) texi "$<" nasmdoc.txt: $(SRCS) rdsrc.pl - $(PERL) $(srcdir)/rdsrc.pl txt < $< + $(RDSRC) txt "$<" + +version.src: $(top_srcdir)/version.pl $(top_srcdir)/version + $(PERL) $(top_srcdir)/version.pl docsrc \ + < $(top_srcdir)/version > version.src -nasmdoc.ps: nasmdoc.dip nasmlogo.eps $(srcdir)/../version genpsdriver.pl \ - genps.pl psfonts.ph pswidth.ph head.ps - $(PERL) $(srcdir)/genpsdriver.pl > nasmdoc.ps +nasmdoc.ps: nasmdoc.dip nasmlogo.eps \ + genps.pl psfonts.ph pswidth.ph head.ps + $(PERL) $(srcdir)/genps.pl -headps $(srcdir)/head.ps nasmdoc.dip \ + > nasmdoc.ps nasmdoc.pdf: nasmdoc.ps $(ACRODIST) -n -q --nosecurity -o $@ $< || \ @@ -88,7 +96,7 @@ nasm.inf: nasmdoc.ipf clean: -rm -f *.rtf *.hpj *.texi *.gid *.ipf *.dip -rm -f *.aux *.cp *.fn *.ky *.pg *.log *.toc *.tp *.vr - -rm -f inslist.src + -rm -f inslist.src version.src spotless: clean -rm -rf html info diff --git a/doc/genps.pl b/doc/genps.pl index 67e0f36..86d1000 100755 --- a/doc/genps.pl +++ b/doc/genps.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ## -------------------------------------------------------------------------- ## -## Copyright 1996-2012 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. ## @@ -36,9 +36,6 @@ # Format the documentation as PostScript # -use Env; -use lib $srcdir; - require 'psfonts.ph'; # The fonts we want to use require 'pswidth.ph'; # PostScript string width @@ -87,6 +84,9 @@ use Fcntl; '11x17' => [792,1224], # US double paper size ); +# Canned header file +$headps = 'head.ps'; + # # Parse the command line # @@ -104,6 +104,8 @@ while ( $arg = shift(@ARGV) ) { $psconf{$parm} = shift(@ARGV); } elsif ( $parm =~ /^(title|subtitle|year|author|license)$/ ) { $metadata{$parm} = shift(@ARGV); + } elsif ( $parm eq 'headps' ) { + $headps = shift(@ARGV); } else { die "$0: Unknown option: $arg\n"; } @@ -1028,7 +1030,8 @@ foreach $fset ( @AllFonts ) { print "/bullet [",ps_string($charcode{'bullet'}),"] def\n"; # Emit the canned PostScript prologue -open(PSHEAD, "< head.ps"); +open(PSHEAD, '<', $headps) + or die "$0: cannot open: $headps: $!\n"; while ( defined($line = <PSHEAD>) ) { print $line; } diff --git a/doc/genpsdriver.pl b/doc/genpsdriver.pl deleted file mode 100644 index 58e1f9a..0000000 --- a/doc/genpsdriver.pl +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/perl -## -------------------------------------------------------------------------- -## -## Copyright 1996-2009 The NASM Authors - All Rights Reserved -## See the file AUTHORS included with the NASM distribution for -## the specific copyright holders. -## -## Redistribution and use in source and binary forms, with or without -## modification, are permitted provided that the following -## conditions are met: -## -## * Redistributions of source code must retain the above copyright -## notice, this list of conditions and the following disclaimer. -## * Redistributions in binary form must reproduce the above -## copyright notice, this list of conditions and the following -## disclaimer in the documentation and/or other materials provided -## with the distribution. -## -## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND -## CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, -## INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -## DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR -## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -## NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -## LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -## HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -## CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, -## EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -## -## -------------------------------------------------------------------------- - -# -# Runs the equivalent of the following command line: -# -# $(PERL) $(srcdir)/genps.pl -subtitle "version `cat ../version`" \ -# nasmdoc.dip -# -# This is implemented as a Perl script since `cat ...` doesn't -# necessarily work on non-Unix systems. -# - -use File::Spec; -use Fcntl; -use Env; - -$perl = $ENV{PERL} || 'perl'; -$srcdir = $ENV{srcdir} || File::Spec->curdir(); - -$versionfile = File::Spec->catfile($srcdir, File::Spec->updir(), 'version'); -$genps = File::Spec->catfile($srcdir, 'genps.pl'); - -sysopen(VERSION, $versionfile, O_RDONLY) - or die "$0: cannot open $versionfile\n"; -$version = <VERSION>; -chomp $version; -close(VERSION); - -# \240 = no-break space, see @NASMEncoding in genps.pl. -# If we use a normal space, it breaks on 'doze platforms... -system($perl, $genps, '-subtitle', "version\240".$version, - @ARGV, 'nasmdoc.dip'); diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index f38a9ce..e41c086 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -33,6 +33,7 @@ \# \# Source code to NASM documentation \# + \M{category}{Programming} \M{title}{NASM - The Netwide Assembler} \M{year}{1996-2016} @@ -45,6 +46,9 @@ \M{infotitle}{The Netwide Assembler for x86} \M{epslogo}{nasmlogo.eps} \M{logoyadj}{-72} + +\& version.src + \IR{-D} \c{-D} option \IR{-E} \c{-E} option \IR{-F} \c{-F} option @@ -8254,4 +8258,3 @@ column shows the processor type in which the instruction was introduced and, \A{changelog} \i{NASM Version History} \& changes.src - diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl index 21ec6e7..da9cf25 100644 --- a/doc/rdsrc.pl +++ b/doc/rdsrc.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl ## -------------------------------------------------------------------------- -## +## ## Copyright 1996-2016 The NASM Authors - All Rights Reserved ## See the file AUTHORS included with the NASM distribution for ## the specific copyright holders. @@ -15,7 +15,7 @@ ## copyright notice, this list of conditions and the following ## disclaimer in the documentation and/or other materials provided ## with the distribution. -## +## ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND ## CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, ## INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -116,12 +116,20 @@ # \&{filename} # Includes filename. Recursion is allowed. # - -use IO::File; + +use File::Spec; + +@include_path = (); $diag = 1, shift @ARGV if $ARGV[0] eq "-d"; +while ($ARGV[0] =~ /^\-[Ii](.*)$/) { + push(@include_path, $1); + shift; +} -($out_format) = @ARGV; +$out_format = shift(@ARGV); +@files = @ARGV; +@files = ('-') unless(scalar(@files)); $| = 1; @@ -136,9 +144,8 @@ print "Reading input..."; $pname = "para000000"; @pnames = @pflags = (); $para = undef; -while (defined($_ = <STDIN>)) { - $_ = &untabify($_); - &check_include($_); +foreach $file (@files) { + &include($file); } &got_para($para); print "done.\n"; @@ -205,8 +212,9 @@ sub untabify($) { } return $o; } -sub check_include { +sub read_line { local $_ = shift; + $_ = &untabify($_); if (/\\& (\S+)/) { &include($1); } else { @@ -226,11 +234,25 @@ sub get_para($_) { } sub include { my $name = shift; - my $F = IO::File->new($name) - or die "Cannot open $name: $!"; - while (<$F>) { - &check_include($_); + my $F; + + if ($name eq '-') { + open($F, '<-'); # stdin + } else { + my $found = 0; + foreach my $idir ( File::Spec->curdir, @include_path ) { + my $fpath = File::Spec->catfile($idir, $name); + if (open($F, '<', $fpath)) { + $found = 1; + last; + } + } + die "Cannot open $name: $!\n" unless ($found); + } + while (defined($_ = <$F>)) { + &read_line($_); } + close($F); } sub got_para { local ($_) = @_; @@ -1493,7 +1515,7 @@ sub add_item { # sub write_dip { open(PARAS, "> nasmdoc.dip"); - foreach $k (keys(%metadata)) { + foreach $k (sort(keys(%metadata))) { print PARAS 'meta :', $k, "\n"; print PARAS $metadata{$k},"\n"; } diff --git a/nsis/nasm.nsi b/nsis/nasm.nsi index 4241103..ebb8ef9 100644 --- a/nsis/nasm.nsi +++ b/nsis/nasm.nsi @@ -26,6 +26,8 @@ # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +!addincludedir "${objdir}/nsis" +!addincludedir "${srcdir}/nsis" !include "version.nsh" !include /nonfatal "arch.nsh" @@ -50,7 +52,7 @@ SetCompressor lzma ;Name and file Name "${PACKAGE_NAME}" -OutFile "../${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe" +OutFile "${objdir}/${PACKAGE_SHORT_NAME}-installer-${ARCH}.exe" ;Get installation folder from registry if available InstallDirRegKey HKCU "Software\${PRODUCT_SHORT_NAME}" "" @@ -67,8 +69,8 @@ Var CmdFailed ;-------------------------------- ;Interface Settings Caption "${PACKAGE_SHORT_NAME} installation" -Icon "nasm.ico" -UninstallIcon "nasm-un.ico" +Icon "${srcdir}/nsis/nasm.ico" +UninstallIcon "${srcdir}/nsis/nasm-un.ico" !define MUI_ABORTWARNING @@ -98,10 +100,10 @@ UninstallIcon "nasm-un.ico" Section "NASM" SecNasm Sectionin RO SetOutPath "$INSTDIR" - File "../LICENSE" - File "../nasm.exe" - File "../ndisasm.exe" - File "nasm.ico" + File "${srcdir}/LICENSE" + File "${objdir}/nasm.exe" + File "${objdir}/ndisasm.exe" + File "${srcdir}/nsis/nasm.ico" ;Store installation folder WriteRegStr HKCU "Software\${PRODUCT_SHORT_NAME}" "" $INSTDIR @@ -137,27 +139,27 @@ skip: SectionEnd Section "RDOFF" SecRdoff - File "../rdoff/ldrdf.exe" - File "../rdoff/rdf2bin.exe" - File "../rdoff/rdf2com.exe" - File "../rdoff/rdf2ith.exe" - File "../rdoff/rdf2ihx.exe" - File "../rdoff/rdf2srec.exe" - File "../rdoff/rdfdump.exe" - File "../rdoff/rdflib.exe" + File "${objdir}/rdoff/ldrdf.exe" + File "${objdir}/rdoff/rdf2bin.exe" + File "${objdir}/rdoff/rdf2com.exe" + File "${objdir}/rdoff/rdf2ith.exe" + File "${objdir}/rdoff/rdf2ihx.exe" + File "${objdir}/rdoff/rdf2srec.exe" + File "${objdir}/rdoff/rdfdump.exe" + File "${objdir}/rdoff/rdflib.exe" SectionEnd Section "Manual" SecManual SetOutPath "$INSTDIR" - File "../doc/nasmdoc.pdf" + File "${objdir}/doc/nasmdoc.pdf" CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Manual.lnk" "$INSTDIR\nasmdoc.pdf" SectionEnd Section "VS8 integration" SecVS8 CreateDirectory "$INSTDIR\VSrules" SetOutPath "$INSTDIR\VSrules" - File "../contrib/VSrules/nasm.README" - File "../contrib/VSrules/nasm.rules" + File "${srcdir}/contrib/VSrules/nasm.README" + File "${srcdir}/contrib/VSrules/nasm.rules" SectionEnd ;-------------------------------- diff --git a/version.pl b/version.pl index e4157a2..a5577a0 100755 --- a/version.pl +++ b/version.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl ## -------------------------------------------------------------------------- ## -## Copyright 1996-2009 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. ## @@ -178,6 +178,9 @@ if ( $what eq 'h' ) { print $nasm_id, "\n"; # Print ID in decimal } elsif ( $what eq 'xid' ) { printf "0x%08x\n", $nasm_id; # Print ID in hexadecimal +} elsif ( $what eq 'docsrc' ) { + printf "\\M{version}{%s}\n", $line; + printf "\\M{subtitle}{version %s}\n", $line; } else { die "$0: Unknown output: $what\n"; } |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-17 03:33:18
|
Commit-ID: b06736ae7ee2af15c2d7176ca9cf241661b7cb49 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b06736ae7ee2af15c2d7176ca9cf241661b7cb49 Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 16 May 2016 13:20:01 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 16 May 2016 13:20:01 -0700 Unbreak building in a separate object directory Fix bitrot in building in a separate object directory. Signed-off-by: H. Peter Anvin <hp...@li...> --- Makefile.in | 4 ++-- Mkfiles/msvc.mak | 2 +- Mkfiles/openwcom.mak | 2 +- Mkfiles/owlinux.mak | 2 +- configure.in | 2 +- rdoff/Makefile.in | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Makefile.in b/Makefile.in index 1479a62..13b10ce 100644 --- a/Makefile.in +++ b/Makefile.in @@ -22,7 +22,7 @@ INTERNAL_CFLAGS = -I$(srcdir) -I. ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ -PERL = perl -I$(srcdir)/perllib +PERL = perl -I$(srcdir)/perllib -I$(srcdir) XOBJS = @XOBJS@ @@ -113,7 +113,7 @@ ndisasm$(X): $(NDISASM) $(XOBJS) # instruction-table file by a Perl script. They're distributed, # though, so it isn't necessary to have Perl just to recompile NASM # from the distribution. -INSDEP = insns.dat insns.pl insns-iflags.pl +INSDEP = insns.dat insns.pl iflag.c: $(INSDEP) $(PERL) $(srcdir)/insns.pl -fc $(srcdir)/insns.dat diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak index 35dc9ea..e6c6c3e 100644 --- a/Mkfiles/msvc.mak +++ b/Mkfiles/msvc.mak @@ -33,7 +33,7 @@ INTERNAL_CFLAGS = /I$(srcdir) /I. \ ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) LDFLAGS = $(LDFLAGS) /SUBSYSTEM:CONSOLE LIBS = -PERL = perl -I$(srcdir)/perllib +PERL = perl -I$(srcdir)/perllib -I$(srcdir) # Binary suffixes O = obj diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index 3dffb11..b98bc32 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -22,7 +22,7 @@ LD = *wlink LDEBUG = LDFLAGS = op quiet $(%TARGET_LFLAGS) $(LDEBUG) LIBS = -PERL = perl -I$(srcdir)/perllib +PERL = perl -I$(srcdir)/perllib -I$(srcdir) STRIP = wstrip diff --git a/Mkfiles/owlinux.mak b/Mkfiles/owlinux.mak index ad27d17..611f96d 100644 --- a/Mkfiles/owlinux.mak +++ b/Mkfiles/owlinux.mak @@ -37,7 +37,7 @@ ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) LD = $(CC) LDFLAGS = $(ALL_CFLAGS) LIBS = -PERL = perl -I$(srcdir)/perllib +PERL = perl -I$(srcdir)/perllib -I$(srcdir) STRIP = wstrip diff --git a/configure.in b/configure.in index cbaebc4..56e0ce6 100644 --- a/configure.in +++ b/configure.in @@ -204,5 +204,5 @@ PA_ADD_CFLAGS([-Werror=missing-declarations]) PA_ADD_CFLAGS([-Werror=comment]) PA_ADD_CFLAGS([-Werror=vla])]) -AC_OUTPUT_COMMANDS([mkdir -p output]) +AC_OUTPUT_COMMANDS([mkdir -p lib nsis output]) AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile) diff --git a/rdoff/Makefile.in b/rdoff/Makefile.in index 41fc5f1..e9081ce 100644 --- a/rdoff/Makefile.in +++ b/rdoff/Makefile.in @@ -19,7 +19,7 @@ datarootdir = @datarootdir@ CC = @CC@ CFLAGS = @CFLAGS@ BUILD_CFLAGS = $(CFLAGS) @DEFS@ -INTERNAL_CFLAGS = -I$(srcdir) -I$(top_srcdir) +INTERNAL_CFLAGS = -I$(srcdir) -I$(top_srcdir) -I.. ALL_CFLAGS = $(BUILD_CFLAGS) $(INTERNAL_CFLAGS) LDFLAGS = @LDFLAGS@ |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-16 20:06:17
|
Commit-ID: cba1aca466db66fe1f391f3f1cdd3bd2bd5170de Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=cba1aca466db66fe1f391f3f1cdd3bd2bd5170de Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 16 May 2016 13:05:04 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 16 May 2016 13:05:04 -0700 autogen.sh: remove configure-generated files Remove files generated by configure when running autogen.sh. Signed-off-by: H. Peter Anvin <hp...@li...> --- autogen.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/autogen.sh b/autogen.sh index 5a1395d..1a8d21b 100755 --- a/autogen.sh +++ b/autogen.sh @@ -5,3 +5,4 @@ autoheader autoconf rm -rf autom4te.cache config.log config.status +rm -f Makefile rdoff/Makefile doc/Makefile config.h |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-10 22:42:16
|
Commit-ID: 6a5b3ecb160dbb06a91158d889912a7d370bfcd0 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=6a5b3ecb160dbb06a91158d889912a7d370bfcd0 Author: H. Peter Anvin <hp...@li...> AuthorDate: Tue, 10 May 2016 12:24:04 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 10 May 2016 15:40:24 -0700 codeview: use nasm_free() instead of plain free() We want to consistently use our allocator wrapper functions whereever possible. Signed-off-by: H. Peter Anvin <hp...@li...> --- output/codeview.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/output/codeview.c b/output/codeview.c index 616f574..84abd7d 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -285,16 +285,16 @@ static void cv8_cleanup(void) build_type_table(type_sect); if (cv8_state.source_file.name != NULL) - free(cv8_state.source_file.name); + nasm_free(cv8_state.source_file.name); if (cv8_state.cwd != NULL) - free(cv8_state.cwd); + nasm_free(cv8_state.cwd); saa_free(cv8_state.lines); saa_rewind(cv8_state.symbols); while ((sym = saa_rstruct(cv8_state.symbols))) - free(sym->name); + nasm_free(sym->name); saa_free(cv8_state.symbols); } |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-10 22:18:18
|
Commit-ID: 55e51d9534a547c7bd4148d952b317884991078e Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=55e51d9534a547c7bd4148d952b317884991078e Author: H. Peter Anvin <hp...@li...> AuthorDate: Tue, 10 May 2016 15:14:30 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 10 May 2016 15:14:30 -0700 nasmlib/file.c: Windows _chsize_s() *returns* errno _chsize_s(), but not _chsize(), actually *returns* errno rather than setting errno; create a wrapper routine to make it match the other nasm_ftruncate() varieties. Signed-off-by: H. Peter Anvin <hp...@li...> --- nasmlib/file.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/nasmlib/file.c b/nasmlib/file.c index 6ba3844..ce22ea3 100644 --- a/nasmlib/file.c +++ b/nasmlib/file.c @@ -60,7 +60,17 @@ /* Can we adjust the file size without actually writing all the bytes? */ #ifdef HAVE_FILENO /* Useless without fileno() */ # ifdef HAVE__CHSIZE_S -# define nasm_ftruncate(fd,size) _chsize_s(fd,size) +static int nasm_ftruncate(int fd, int64_t size) +{ + int err = _chsize_s(fd, size); + + if (!err) + return 0; + + errno = err; + return -1; +} +# define nasm_ftruncate(fd,size) nasm_ftruncate(fd,size) # elif defined(HAVE__CHSIZE) # define nasm_ftruncate(fd,size) _chsize(fd,size) # elif defined(HAVE_FTRUNCATE) |
From: nasm-bot f. C. G. <gor...@gm...> - 2016-05-10 20:30:21
|
Commit-ID: 771d04e263f16ed496da3573e8b0481d7c25314d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=771d04e263f16ed496da3573e8b0481d7c25314d Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Tue, 10 May 2016 23:27:03 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Tue, 10 May 2016 23:27:03 +0300 preproc: Don't dereference nil @istk If not input was specified istk = NULL, so don't dereference it. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- preproc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/preproc.c b/preproc.c index 0c9bf2d..9dc3d88 100644 --- a/preproc.c +++ b/preproc.c @@ -5277,7 +5277,8 @@ static void pp_error_list_macros(int severity) severity |= ERR_PP_LISTMACRO | ERR_NO_SEVERITY; src_get(&saved_line, &saved_fname); - pp_list_one_macro(istk->mstk, severity); + if (istk) + pp_list_one_macro(istk->mstk, severity); src_set(saved_line, saved_fname); } |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-10 16:03:20
|
Commit-ID: acb48602fc506e8073c477309db707978724b7a5 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=acb48602fc506e8073c477309db707978724b7a5 Author: H. Peter Anvin <hp...@li...> AuthorDate: Tue, 10 May 2016 09:01:10 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 10 May 2016 09:01:10 -0700 srcfile.c: remove unnecessary #include's Remove #include's inherited from nasmlib.c which aren't needed in this file. Signed-off-by: H. Peter Anvin <hp...@li...> --- srcfile.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/srcfile.c b/srcfile.c index e84a8fb..7bee017 100644 --- a/srcfile.c +++ b/srcfile.c @@ -37,11 +37,7 @@ #include "compiler.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#include <ctype.h> -#include <errno.h> #include <inttypes.h> #include "nasmlib.h" |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-05-10 10:15:18
|
Commit-ID: cfbdc3c6fa7378355b7c1fd8f785af39fbd6765d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=cfbdc3c6fa7378355b7c1fd8f785af39fbd6765d Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 10 May 2016 03:12:28 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 10 May 2016 03:12:28 -0700 NASM 2.12.02rc4 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 913b31b..9c8e3df 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.12.02rc3 +2.12.02rc4 |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-05-10 10:12:22
|
Commit-ID: b157701b17c38fe3f84aab6a43ed34d17e5c91d2 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b157701b17c38fe3f84aab6a43ed34d17e5c91d2 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 10 May 2016 02:54:15 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 10 May 2016 02:59:04 -0700 quote: make the input argument to nasm_quote() const Whereas nasm_unquote() unquotes the argument in place, nasm_quote() has to allocate a new string (since the new string will *always* be longer than the old string!) Make the old string const since we're making a copy anyway. Signed-off-by: H. Peter Anvin <hp...@zy...> --- quote.c | 5 +++-- quote.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/quote.c b/quote.c index d1cbfd4..75a9372 100644 --- a/quote.c +++ b/quote.c @@ -42,9 +42,10 @@ #include "nasmlib.h" #include "quote.h" -char *nasm_quote(char *str, size_t len) +char *nasm_quote(const char *str, size_t len) { - char c, c1, *p, *q, *nstr, *ep; + const char *p, *ep; + char c, c1, *q, *nstr; unsigned char uc; bool sq_ok, dq_ok; size_t qlen; diff --git a/quote.h b/quote.h index 13089cb..2d8ce87 100644 --- a/quote.h +++ b/quote.h @@ -36,7 +36,7 @@ #include "compiler.h" -char *nasm_quote(char *str, size_t len); +char *nasm_quote(const char *str, size_t len); size_t nasm_unquote(char *str, char **endptr); char *nasm_skip_string(char *str); |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-05-10 10:12:21
|
Commit-ID: 02f49f2c1e4c03ae95177ac2d46060d2cae63967 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=02f49f2c1e4c03ae95177ac2d46060d2cae63967 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 10 May 2016 03:08:09 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 10 May 2016 03:08:09 -0700 stdscan: put some error message strings in quotes Put some error message strings inside `...' quotes to match existing usage. Signed-off-by: H. Peter Anvin <hp...@zy...> --- stdscan.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stdscan.c b/stdscan.c index d6cf5d5..33ccfec 100644 --- a/stdscan.c +++ b/stdscan.c @@ -114,7 +114,7 @@ static int stdscan_handle_brace(struct tokenval *tv) if (!(tv->t_flag & TFLAG_BRC_ANY)) { /* invalid token is put inside braces */ nasm_error(ERR_NONFATAL, - "%s is not a valid decorator with braces", tv->t_charptr); + "`%s' is not a valid decorator with braces", tv->t_charptr); tv->t_type = TOKEN_INVALID; } else if (tv->t_flag & TFLAG_BRC_OPT) { if (is_reg_class(OPMASKREG, tv->t_integer)) { @@ -169,7 +169,7 @@ int stdscan(void *private_data, struct tokenval *tv) if (unlikely(tv->t_flag & TFLAG_WARN)) { nasm_error(ERR_WARNING|ERR_PASS1|ERR_WARN_PTR, - "%s is not a NASM keyword", tv->t_charptr); + "`%s' is not a NASM keyword", tv->t_charptr); } if (likely(!(tv->t_flag & TFLAG_BRC))) { |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-05-10 10:12:20
|
Commit-ID: 274cda81f8f644c3e8b859f778e61af34fd6e776 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=274cda81f8f644c3e8b859f778e61af34fd6e776 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Tue, 10 May 2016 02:56:29 -0700 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Tue, 10 May 2016 03:01:58 -0700 Use a hash to keep exactly one copy of each filename around The old code for keeping track of source file name and line was confused as hell about ownership of the strings, and it is pretty clear we leaked that information all over the place. Instead, use a hash table to keep a copy of each string as necessary, and simply make references to a string pool that we keep until the end of the assembly session. This pool probably should be unified with the list of dependency files, and so on, but that is for the development branch. Signed-off-by: H. Peter Anvin <hp...@zy...> --- Makefile.in | 3 +- Mkfiles/msvc.mak | 3 +- Mkfiles/netware.mak | 3 +- Mkfiles/openwcom.mak | 3 +- Mkfiles/owlinux.mak | 3 +- assemble.c | 2 +- nasm.c | 14 +++--- nasmlib.c | 44 ----------------- nasmlib.h | 15 ++++-- preproc-nop.c | 7 ++- preproc.c | 38 ++++++--------- srcfile.c | 132 +++++++++++++++++++++++++++++++++++++++++++++++++++ 12 files changed, 180 insertions(+), 87 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4a5b3b0..1479a62 100644 --- a/Makefile.in +++ b/Makefile.in @@ -74,7 +74,7 @@ endif #-- Begin File Lists --# NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ - raa.$(O) saa.$(O) rbtree.$(O) \ + raa.$(O) saa.$(O) rbtree.$(O) srcfile.$(O) \ realpath.$(O) \ float.$(O) insnsa.$(O) insnsb.$(O) \ directiv.$(O) \ @@ -444,6 +444,7 @@ regflags.$(O): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h \ regs.$(O): regs.c compiler.h config.h insnsi.h tables.h regvals.$(O): regvals.c compiler.h config.h insnsi.h tables.h saa.$(O): saa.c compiler.h config.h nasmlib.h saa.h +srcfile.$(O): srcfile.c compiler.h config.h hashtbl.h nasmlib.h stdscan.$(O): stdscan.c compiler.h config.h directiv.h iflag.h iflaggen.h \ insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h \ regs.h stdscan.h tables.h tokens.h diff --git a/Mkfiles/msvc.mak b/Mkfiles/msvc.mak index 890ad43..35dc9ea 100644 --- a/Mkfiles/msvc.mak +++ b/Mkfiles/msvc.mak @@ -47,7 +47,7 @@ X = .exe #-- Begin File Lists --# # Edit in Makefile.in, not here! NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ - raa.$(O) saa.$(O) rbtree.$(O) \ + raa.$(O) saa.$(O) rbtree.$(O) srcfile.$(O) \ realpath.$(O) \ float.$(O) insnsa.$(O) insnsb.$(O) \ directiv.$(O) \ @@ -350,6 +350,7 @@ regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \ regs.$(O): regs.c compiler.h insnsi.h tables.h regvals.$(O): regvals.c compiler.h insnsi.h tables.h saa.$(O): saa.c compiler.h nasmlib.h saa.h +srcfile.$(O): srcfile.c compiler.h hashtbl.h nasmlib.h stdscan.$(O): stdscan.c compiler.h directiv.h iflag.h iflaggen.h insns.h \ insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \ stdscan.h tables.h tokens.h diff --git a/Mkfiles/netware.mak b/Mkfiles/netware.mak index c3c8bf6..56509ee 100644 --- a/Mkfiles/netware.mak +++ b/Mkfiles/netware.mak @@ -31,7 +31,7 @@ O = o #-- Begin File Lists --# # Edit in Makefile.in, not here! NASM = nasm.o nasmlib.o ver.o \ - raa.o saa.o rbtree.o \ + raa.o saa.o rbtree.o srcfile.o \ realpath.o \ float.o insnsa.o insnsb.o \ directiv.o \ @@ -251,6 +251,7 @@ regflags.o: regflags.c compiler.h config.h directiv.h insnsi.h nasm.h \ regs.o: regs.c compiler.h config.h insnsi.h tables.h regvals.o: regvals.c compiler.h config.h insnsi.h tables.h saa.o: saa.c compiler.h config.h nasmlib.h saa.h +srcfile.o: srcfile.c compiler.h config.h hashtbl.h nasmlib.h stdscan.o: stdscan.c compiler.h config.h directiv.h iflag.h iflaggen.h \ insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h \ regs.h stdscan.h tables.h tokens.h diff --git a/Mkfiles/openwcom.mak b/Mkfiles/openwcom.mak index 7fb9ba5..3dffb11 100644 --- a/Mkfiles/openwcom.mak +++ b/Mkfiles/openwcom.mak @@ -47,7 +47,7 @@ X = .exe #-- Begin File Lists --# # Edit in Makefile.in, not here! NASM = nasm.$(O) nasmlib.$(O) ver.$(O) & - raa.$(O) saa.$(O) rbtree.$(O) & + raa.$(O) saa.$(O) rbtree.$(O) srcfile.$(O) & realpath.$(O) & float.$(O) insnsa.$(O) insnsb.$(O) & directiv.$(O) & @@ -399,6 +399,7 @@ regflags.$(O): regflags.c compiler.h config.h directiv.h insnsi.h nasm.h & regs.$(O): regs.c compiler.h config.h insnsi.h tables.h regvals.$(O): regvals.c compiler.h config.h insnsi.h tables.h saa.$(O): saa.c compiler.h config.h nasmlib.h saa.h +srcfile.$(O): srcfile.c compiler.h config.h hashtbl.h nasmlib.h stdscan.$(O): stdscan.c compiler.h config.h directiv.h iflag.h iflaggen.h & insns.h insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h & regs.h stdscan.h tables.h tokens.h diff --git a/Mkfiles/owlinux.mak b/Mkfiles/owlinux.mak index b6ddad9..ad27d17 100644 --- a/Mkfiles/owlinux.mak +++ b/Mkfiles/owlinux.mak @@ -58,7 +58,7 @@ X = .exe #-- Begin File Lists --# # Edit in Makefile.in, not here! NASM = nasm.$(O) nasmlib.$(O) ver.$(O) \ - raa.$(O) saa.$(O) rbtree.$(O) \ + raa.$(O) saa.$(O) rbtree.$(O) srcfile.$(O) \ realpath.$(O) \ float.$(O) insnsa.$(O) insnsb.$(O) \ directiv.$(O) \ @@ -361,6 +361,7 @@ regflags.$(O): regflags.c compiler.h directiv.h insnsi.h nasm.h nasmlib.h \ regs.$(O): regs.c compiler.h insnsi.h tables.h regvals.$(O): regvals.c compiler.h insnsi.h tables.h saa.$(O): saa.c compiler.h nasmlib.h saa.h +srcfile.$(O): srcfile.c compiler.h hashtbl.h nasmlib.h stdscan.$(O): stdscan.c compiler.h directiv.h iflag.h iflaggen.h insns.h \ insnsi.h nasm.h nasmlib.h opflags.h pptok.h preproc.h quote.h regs.h \ stdscan.h tables.h tokens.h diff --git a/assemble.c b/assemble.c index 584bed7..b9e01e6 100644 --- a/assemble.c +++ b/assemble.c @@ -335,7 +335,7 @@ static void out(int64_t offset, int32_t segto, const void *data, int32_t segment, int32_t wrt) { static int32_t lineno = 0; /* static!!! */ - static char *lnfname = NULL; + static const char *lnfname = NULL; uint8_t p[8]; int asize = addrsize(type, size); /* Address size in bytes */ const int amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */ diff --git a/nasm.c b/nasm.c index 3bf98af..4df3c37 100644 --- a/nasm.c +++ b/nasm.c @@ -340,6 +340,7 @@ int main(int argc, char **argv) error_file = stderr; tolower_init(); + src_init(); offsets = raa_init(); forwrefs = saa_init((int32_t)sizeof(struct forwrefinfo)); @@ -402,7 +403,7 @@ int main(int argc, char **argv) preproc->cleanup(0); } else if (operating_mode & OP_PREPROCESS) { char *line; - char *file_name = NULL; + const char *file_name = NULL; int32_t prior_linnum = 0; int lineinc = 0; @@ -442,7 +443,6 @@ int main(int argc, char **argv) nasm_fputs(line, ofile); nasm_free(line); } - nasm_free(file_name); preproc->cleanup(0); if (ofile) fclose(ofile); @@ -482,9 +482,11 @@ int main(int argc, char **argv) ofmt->cleanup(); cleanup_labels(); fflush(ofile); - if (ferror(ofile)) + if (ferror(ofile)) { nasm_error(ERR_NONFATAL|ERR_NOFILE, "write error on output file `%s'", outname); + terminate_after_phase = true; + } } if (ofile) { @@ -505,6 +507,7 @@ int main(int argc, char **argv) saa_free(forwrefs); eval_cleanup(); stdscan_cleanup(); + src_free(); return terminate_after_phase; } @@ -1869,7 +1872,7 @@ static enum directives getkw(char **directive, char **value) */ static void nasm_verror_gnu(int severity, const char *fmt, va_list ap) { - char *currentfile = NULL; + const char *currentfile = NULL; int32_t lineno = 0; if (is_suppressed_warning(severity)) @@ -1906,7 +1909,7 @@ static void nasm_verror_gnu(int severity, const char *fmt, va_list ap) */ static void nasm_verror_vc(int severity, const char *fmt, va_list ap) { - char *currentfile = NULL; + const char *currentfile = NULL; int32_t lineno = 0; if (is_suppressed_warning(severity)) @@ -1918,7 +1921,6 @@ static void nasm_verror_vc(int severity, const char *fmt, va_list ap) if (!skip_this_pass(severity)) { if (currentfile) { fprintf(error_file, "%s(%"PRId32") : ", currentfile, lineno); - nasm_free(currentfile); } else { fputs("nasm: ", error_file); } diff --git a/nasmlib.c b/nasmlib.c index 2bea64b..f299f35 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -553,50 +553,6 @@ int bsii(const char *string, const char **array, int size) return -1; /* we haven't got it :( */ } -static char *file_name = NULL; -static int32_t line_number = 0; - -char *src_set_fname(char *newname) -{ - char *oldname = file_name; - file_name = newname; - return oldname; -} - -int32_t src_set_linnum(int32_t newline) -{ - int32_t oldline = line_number; - line_number = newline; - return oldline; -} - -/* This returns a pointer, not a copy, to the current fname */ -const char *src_get_fname(void) -{ - return file_name; -} - -int32_t src_get_linnum(void) -{ - return line_number; -} - -int src_get(int32_t *xline, char **xname) -{ - if (!file_name || !*xname || strcmp(*xname, file_name)) { - nasm_free(*xname); - *xname = file_name ? nasm_strdup(file_name) : NULL; - *xline = line_number; - return -2; - } - if (*xline != line_number) { - int32_t tmp = line_number - *xline; - *xline = line_number; - return tmp; - } - return 0; -} - char *nasm_strcat(const char *one, const char *two) { char *rslt; diff --git a/nasmlib.h b/nasmlib.h index 08b2dc3..a4870d8 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -392,17 +392,24 @@ void fwriteaddr(uint64_t data, int size, FILE * fp); int bsi(const char *string, const char **array, int size); int bsii(const char *string, const char **array, int size); -char *src_set_fname(char *newname); +/* + * These functions are used to keep track of the source code file and name. + */ +void src_init(void); +void src_free(void); +const char *src_set_fname(const char *newname); const char *src_get_fname(void); int32_t src_set_linnum(int32_t newline); int32_t src_get_linnum(void); +/* Can be used when there is no need for the old information */ +void src_set(int32_t line, const char *filename); /* - * src_get may be used if you simply want to know the source file and line. + * src_get gets both the source file name and line. * It is also used if you maintain private status about the source location * It return 0 if the information was the same as the last time you - * checked, -1 if the name changed and (new-old) if just the line changed. + * checked, -2 if the name changed and (new-old) if just the line changed. */ -int src_get(int32_t *xline, char **xname); +int32_t src_get(int32_t *xline, const char **xname); char *nasm_strcat(const char *one, const char *two); diff --git a/preproc-nop.c b/preproc-nop.c index f8513a8..56ef031 100644 --- a/preproc-nop.c +++ b/preproc-nop.c @@ -60,8 +60,7 @@ static int32_t nop_lineinc; static void nop_reset(char *file, int pass, StrList **deplist) { - src_set_fname(nasm_strdup(file)); - src_set_linnum(0); + src_set(0, file); nop_lineinc = 1; nop_fp = fopen(file, "r"); @@ -121,9 +120,9 @@ static char *nop_getline(void) int li; char *nm = nasm_malloc(strlen(buffer)); if (sscanf(buffer + 5, "%"PRId32"+%d %s", &ln, &li, nm) == 3) { - nasm_free(src_set_fname(nm)); - src_set_linnum(ln); + src_set(ln, nm); nop_lineinc = li; + nasm_free(nm); continue; } nasm_free(nm); diff --git a/preproc.c b/preproc.c index d235280..0c9bf2d 100644 --- a/preproc.c +++ b/preproc.c @@ -156,7 +156,7 @@ struct MMacro { int lineno; /* Current line number on expansion */ uint64_t condcnt; /* number of if blocks... */ - char *fname; /* File where defined */ + const char *fname; /* File where defined */ int32_t xline; /* First line in macro */ }; @@ -271,7 +271,7 @@ struct Include { FILE *fp; Cond *conds; Line *expansion; - char *fname; + const char *fname; int lineno, lineinc; MMacro *mstk; /* stack of active macros/reps */ }; @@ -628,7 +628,6 @@ static void free_mmacro(MMacro * m) free_tlist(m->dlist); nasm_free(m->defaults); free_llist(m->expansion); - nasm_free(m->fname); nasm_free(m); } @@ -2522,7 +2521,7 @@ static int do_directive(Token * tline) /* -MG given but file not found */ nasm_free(inc); } else { - inc->fname = src_set_fname(nasm_strdup(p)); + inc->fname = src_set_fname(p); inc->lineno = src_set_linnum(0); inc->lineinc = 1; inc->expansion = NULL; @@ -3578,7 +3577,9 @@ issue_error: src_set_linnum(k); istk->lineinc = m; if (tline) { - nasm_free(src_set_fname(detoken(tline, false))); + char *fname = detoken(tline, false); + src_set_fname(fname); + nasm_free(fname); } free_tlist(origline); return DIRECTIVE_FOUND; @@ -4135,12 +4136,10 @@ again: */ if (!m->expansion) { if (!strcmp("__FILE__", m->name)) { - int32_t num = 0; - char *file = NULL; - src_get(&num, &file); + const char *file = src_get_fname(); + /* nasm_free(tline->text); here? */ tline->text = nasm_quote(file, strlen(file)); tline->type = TOK_STRING; - nasm_free(file); continue; } if (!strcmp("__LINE__", m->name)) { @@ -4855,8 +4854,7 @@ pp_reset(char *file, int apass, StrList **deplist) istk->mstk = NULL; istk->fp = fopen(file, "r"); istk->fname = NULL; - src_set_fname(nasm_strdup(file)); - src_set_linnum(0); + src_set(0, file); istk->lineinc = 1; if (!istk->fp) nasm_fatal(ERR_NOFILE, "unable to open input file `%s'", file); @@ -5032,10 +5030,8 @@ static char *pp_getline(void) "expected `%%endif' before end of file"); } /* only set line and file name if there's a next node */ - if (i->next) { - src_set_linnum(i->lineno); - src_set_fname(nasm_strdup(i->fname)); - } + if (i->next) + src_set(i->lineno, i->fname); istk = i->next; lfmt->downlevel(LIST_INCLUDE); nasm_free(i); @@ -5146,12 +5142,11 @@ static void pp_cleanup(int pass) Include *i = istk; istk = istk->next; fclose(i->fp); - nasm_free(i->fname); nasm_free(i); } while (cstk) ctx_pop(); - nasm_free(src_set_fname(NULL)); + src_set_fname(NULL); if (pass == 0) { IncPath *i; free_llist(predef); @@ -5269,8 +5264,7 @@ static void pp_list_one_macro(MMacro *m, int severity) pp_list_one_macro(m->next_active, severity); if (m->name && !m->nolist) { - src_set_linnum(m->xline + m->lineno); - src_set_fname(m->fname); + src_set(m->xline + m->lineno, m->fname); nasm_error(severity, "... from macro `%s' defined here", m->name); } } @@ -5281,13 +5275,11 @@ static void pp_error_list_macros(int severity) const char *saved_fname = NULL; severity |= ERR_PP_LISTMACRO | ERR_NO_SEVERITY; - saved_line = src_get_linnum(); - saved_fname = src_get_fname(); + src_get(&saved_line, &saved_fname); pp_list_one_macro(istk->mstk, severity); - src_set_fname((char *)saved_fname); - src_set_linnum(saved_line); + src_set(saved_line, saved_fname); } const struct preproc_ops nasmpp = { diff --git a/srcfile.c b/srcfile.c new file mode 100644 index 0000000..e84a8fb --- /dev/null +++ b/srcfile.c @@ -0,0 +1,132 @@ +/* ----------------------------------------------------------------------- * + * + * Copyright 1996-2016 The NASM Authors - All Rights Reserved + * See the file AUTHORS included with the NASM distribution for + * the specific copyright holders. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following + * conditions are met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following + * disclaimer in the documentation and/or other materials provided + * with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND + * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR + * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * ----------------------------------------------------------------------- */ + +/* + * srcfile.c - keep track of the current position in the input stream + */ + +#include "compiler.h" + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <errno.h> +#include <inttypes.h> + +#include "nasmlib.h" +#include "hashtbl.h" + +static const char *file_name = NULL; +static int32_t line_number = 0; + +static struct hash_table filename_hash; + +void src_init(void) +{ + hash_init(&filename_hash, HASH_MEDIUM); +} + +void src_free(void) +{ + struct hash_tbl_node *iter = NULL; + void *dp; + + while ((dp = hash_iterate(&filename_hash, &iter, NULL)) != NULL) + nasm_free(dp); + + hash_free(&filename_hash); +} + +/* + * Set the current filename, returning the old one. The input + * filename is duplicated if needed. + */ +const char *src_set_fname(const char *newname) +{ + struct hash_insert hi; + const char *oldname; + void **dp; + + if (newname) { + dp = hash_find(&filename_hash, newname, &hi); + if (dp) { + newname = (const char *)(*dp); + } else { + newname = nasm_strdup(newname); + hash_add(&hi, newname, (void *)newname); + } + } + + oldname = file_name; + file_name = newname; + return oldname; +} + +int32_t src_set_linnum(int32_t newline) +{ + int32_t oldline = line_number; + line_number = newline; + return oldline; +} + +void src_set(int32_t line, const char *fname) +{ + src_set_fname(fname); + src_set_linnum(line); +} + +const char *src_get_fname(void) +{ + return file_name; +} + +int32_t src_get_linnum(void) +{ + return line_number; +} + +int32_t src_get(int32_t *xline, const char **xname) +{ + const char *xn = *xname; + int32_t xl = *xline; + + *xline = line_number; + *xname = file_name; + + /* XXX: Is the strcmp() really needed here? */ + if (!file_name || !xn || (xn != file_name && strcmp(xn, file_name))) + return -2; + else + return line_number - xl; +} |
From: nasm-bot f. F. G. <fa...@ra...> - 2016-05-10 09:06:23
|
Commit-ID: 142285ddd8e8d2cb08003198d7186db9d3286ac1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=142285ddd8e8d2cb08003198d7186db9d3286ac1 Author: Fabian Giesen <fa...@ra...> AuthorDate: Thu, 28 Apr 2016 13:48:15 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Tue, 10 May 2016 12:01:22 +0300 codeview: Make md5sum calc read file in 'binary' mode When assembling on Windows machines with CRLF line endings, computing the MD5 hash from the file read in "text" mode (transforms CRLF->LF) gives incorrect results. Signed-off-by: Fabian Giesen <fa...@ra...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/codeview.c | 2 +- preproc.c | 12 ++++++------ preproc.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/output/codeview.c b/output/codeview.c index 571cbab..56c46f2 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -309,7 +309,7 @@ static void calc_md5(const char *const filename, FILE *f; MD5_CTX ctx; - f = pp_input_fopen(filename); + f = pp_input_fopen(filename, "rb"); if (!f) goto done; diff --git a/preproc.c b/preproc.c index 78263fb..d235280 100644 --- a/preproc.c +++ b/preproc.c @@ -1509,7 +1509,7 @@ static bool in_list(const StrList *list, const char *str) * the end of the path. */ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, - bool missing_ok) + bool missing_ok, const char *mode) { FILE *fp; char *prefix = ""; @@ -1522,7 +1522,7 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, sl = nasm_malloc(prefix_len+len+1+sizeof sl->next); memcpy(sl->str, prefix, prefix_len); memcpy(sl->str+prefix_len, file, len+1); - fp = fopen(sl->str, "r"); + fp = fopen(sl->str, mode); if (fp && dhead && !in_list(*dhead, sl->str)) { sl->next = NULL; **dtail = sl; @@ -1564,13 +1564,13 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, * that get a file:lineno pair and need to look at the file again * (e.g. the CodeView debug backend). Returns NULL on failure. */ -FILE *pp_input_fopen(const char *filename) +FILE *pp_input_fopen(const char *filename, const char *mode) { FILE *fp; StrList *xsl = NULL; StrList **xst = &xsl; - fp = inc_fopen(filename, &xsl, &xst, true); + fp = inc_fopen(filename, &xsl, &xst, true, mode); if (xsl) nasm_free(xsl); return fp; @@ -2517,7 +2517,7 @@ static int do_directive(Token * tline) inc = nasm_malloc(sizeof(Include)); inc->next = istk; inc->conds = NULL; - inc->fp = inc_fopen(p, dephead, &deptail, pass == 0); + inc->fp = inc_fopen(p, dephead, &deptail, pass == 0, "r"); if (!inc->fp) { /* -MG given but file not found */ nasm_free(inc); @@ -3260,7 +3260,7 @@ issue_error: if (t->type != TOK_INTERNAL_STRING) nasm_unquote(p, NULL); - fp = inc_fopen(p, &xsl, &xst, true); + fp = inc_fopen(p, &xsl, &xst, true, "r"); if (fp) { p = xsl->str; fclose(fp); /* Don't actually care about the file */ diff --git a/preproc.h b/preproc.h index 3dee45f..3d1aa9c 100644 --- a/preproc.h +++ b/preproc.h @@ -49,6 +49,6 @@ typedef const unsigned char macros_t; enum preproc_token pp_token_hash(const char *token); /* Opens an include file or input file. This uses the include path. */ -FILE *pp_input_fopen(const char *filename); +FILE *pp_input_fopen(const char *filename, const char *mode); #endif |
From: nasm-bot f. F. G. <fa...@ra...> - 2016-05-10 09:06:23
|
Commit-ID: c74a70988520bb25d5fbde22881f43c4e2b06603 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c74a70988520bb25d5fbde22881f43c4e2b06603 Author: Fabian Giesen <fa...@ra...> AuthorDate: Thu, 28 Apr 2016 13:48:16 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Tue, 10 May 2016 12:01:32 +0300 codeview: Call register_file only when producing line numbers Previously, debug info would refer to the first file seen, even when it did not actually generate line numbers (e.g. segto=-1). Fix it so we only lock in the file name the first time we actually produce a line number record. Not as good as proper support for debug info referencing multiple source files but much more useful than the current behavior. Signed-off-by: Fabian Giesen <fa...@ra...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/codeview.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/output/codeview.c b/output/codeview.c index 56c46f2..616f574 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -169,9 +169,6 @@ static void cv8_linenum(const char *filename, int32_t linenumber, struct coff_Section *s; struct linepair *li; - if (cv8_state.source_file.name == NULL) - register_file(filename); - s = find_section(segto); if (s == NULL) return; @@ -179,6 +176,9 @@ static void cv8_linenum(const char *filename, int32_t linenumber, if ((s->flags & IMAGE_SCN_MEM_EXECUTE) == 0) return; + if (cv8_state.source_file.name == NULL) + register_file(filename); + li = saa_wstruct(cv8_state.lines); li->file_offset = cv8_state.text_offset; li->linenumber = linenumber; |
From: nasm-bot f. F. G. <fa...@ra...> - 2016-05-10 09:06:18
|
Commit-ID: 86d8756f0cd255e91c8ef8a4de1ebae3c18d30f3 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=86d8756f0cd255e91c8ef8a4de1ebae3c18d30f3 Author: Fabian Giesen <fa...@ra...> AuthorDate: Thu, 28 Apr 2016 13:48:14 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Tue, 10 May 2016 12:01:08 +0300 codeview: Look up %include path when determining files to hash. The hash calculation in calc_md5 tries to open the source file via "filename" again. For %includes, this is the file name that was specified in the %include directive, not the actual name of the file that was opened by the preprocessor. In other words, this fails if the include file is not in the current working directory. Add pp_input_fopen that uses the preprocessor include path lookup code to resolve a file name and open it, and use that in codeview.c. Signed-off-by: Fabian Giesen <fa...@ra...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- output/codeview.c | 3 ++- preproc.c | 17 +++++++++++++++++ preproc.h | 3 +++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/output/codeview.c b/output/codeview.c index f9750bf..571cbab 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -44,6 +44,7 @@ #include "nasm.h" #include "nasmlib.h" +#include "preproc.h" #include "saa.h" #include "output/outlib.h" #include "output/pecoff.h" @@ -308,7 +309,7 @@ static void calc_md5(const char *const filename, FILE *f; MD5_CTX ctx; - f = fopen(filename, "r"); + f = pp_input_fopen(filename); if (!f) goto done; diff --git a/preproc.c b/preproc.c index e33a6d7..78263fb 100644 --- a/preproc.c +++ b/preproc.c @@ -1560,6 +1560,23 @@ static FILE *inc_fopen(const char *file, StrList **dhead, StrList ***dtail, } /* + * Opens an include or input file. Public version, for use by modules + * that get a file:lineno pair and need to look at the file again + * (e.g. the CodeView debug backend). Returns NULL on failure. + */ +FILE *pp_input_fopen(const char *filename) +{ + FILE *fp; + StrList *xsl = NULL; + StrList **xst = &xsl; + + fp = inc_fopen(filename, &xsl, &xst, true); + if (xsl) + nasm_free(xsl); + return fp; +} + +/* * Determine if we should warn on defining a single-line macro of * name `name', with `nparam' parameters. If nparam is 0 or -1, will * return true if _any_ single-line macro of that name is defined. diff --git a/preproc.h b/preproc.h index fdda37c..3dee45f 100644 --- a/preproc.h +++ b/preproc.h @@ -48,4 +48,7 @@ typedef const unsigned char macros_t; enum preproc_token pp_token_hash(const char *token); +/* Opens an include file or input file. This uses the include path. */ +FILE *pp_input_fopen(const char *filename); + #endif |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-09 21:39:21
|
Commit-ID: 31c97fb89e2cdf5638b863f8dc05c1041a7ddd1d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=31c97fb89e2cdf5638b863f8dc05c1041a7ddd1d Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 9 May 2016 14:37:39 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 9 May 2016 14:37:39 -0700 NASM 2.12.02rc3 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index c782144..913b31b 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.12.02rc2 +2.12.02rc3 |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-09 21:39:20
|
Commit-ID: 77511e32a7e15d2b511c7723c5df28890a593321 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=77511e32a7e15d2b511c7723c5df28890a593321 Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 9 May 2016 14:36:59 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 9 May 2016 14:36:59 -0700 doc: document warning improvements Signed-off-by: H. Peter Anvin <hp...@li...> --- doc/changes.src | 8 +++++++- doc/nasmdoc.src | 10 +++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/doc/changes.src b/doc/changes.src index ab43d60..b6c987c 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -19,7 +19,13 @@ since 2007. \b If the MASM PTR keyword is encountered, issue a warning. This is much more likely to indicate a MASM-ism encountered in NASM than it - is a valid label. This warning can be suppressed with -w-ptr. + is a valid label. This warning can be suppressed with \c{-w-ptr}, + the \c{[warning]} directive (see \k{opt-w}) or by the macro + definition \c{%idefine ptr %??}. + +\b When an error or a warning comes from the expansion of a multi-line + macro, display the file and line numbers for the expanded macros. + Macros defined with \c{.nolist} do not get displayed. \S{cl-2.12.01} Version 2.12.01 diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 55be9d9..f38a9ce 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -963,13 +963,21 @@ Enabled by default. form of jmp instruction becomes jmp short form. Enabled by default. +\b \i\c{zext-reloc} warns that a relocation has been zero-extended due +to limitations in the output format. + +\b \i\c\{ptr} warns about keywords used in other assemblers that might +indicate a mistake in the source code. Currently only the MASM +\c{PTR} keyword is recognized. + \b \i\c{error} causes warnings to be treated as errors. Disabled by default. \b \i\c{all} is an alias for \e{all} suppressible warning classes (not including \c{error}). Thus, \c{-w+all} enables all available warnings. -In addition, you can set warning classes across sections. +In addition, you can control warnings in the source code itself, using +the \i\c{[warning]} directive. Warning classes may be enabled with \i\c{[warning +warning-name]}, disabled with \i\c{[warning -warning-name]} or reset to their original value with \i\c{[warning *warning-name]}. No "user form" |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-09 21:15:21
|
Commit-ID: f43aedac2323cfad88fc4ac53b2c7d9597623e2c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=f43aedac2323cfad88fc4ac53b2c7d9597623e2c Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 9 May 2016 14:14:11 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 9 May 2016 14:14:11 -0700 .gitignore: add .s and .i files .s and .i files can be generated during debugging. Signed-off-by: H. Peter Anvin <hp...@li...> --- .gitignore | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index f64b70a..83236c5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ *.bin *.dbg *.exe +*.i *.lst *.o *.o64 @@ -9,8 +10,9 @@ *.orig *.out *.rej -*.xml +*.s *.swp +*.xml .*swo *~ \#* |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-05-09 21:15:19
|
Commit-ID: 4def1a8db462548f60b3b5b44c2ee585c21af9e0 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=4def1a8db462548f60b3b5b44c2ee585c21af9e0 Author: H. Peter Anvin <hp...@li...> AuthorDate: Mon, 9 May 2016 13:59:44 -0700 Committer: H. Peter Anvin <hp...@li...> CommitDate: Mon, 9 May 2016 13:59:44 -0700 Show the expanded macro stack when displaying diagnostics It can be hard to find errors inside potentially nested macros. Show the mmacro expansion stack when printing diagnostics. Note that a list file doesn't help for errors that are detected before the code-generation pass. Signed-off-by: H. Peter Anvin <hp...@li...> --- nasm.c | 13 +++++++++---- nasm.h | 7 +++++-- nasmlib.c | 6 ++++++ nasmlib.h | 2 ++ preproc-nop.c | 12 +++++++++--- preproc.c | 37 +++++++++++++++++++++++++++++++++---- test/macroerr.asm | 11 +++++++++++ test/macroerr.inc | 3 +++ 8 files changed, 78 insertions(+), 13 deletions(-) diff --git a/nasm.c b/nasm.c index f46cf4f..3bf98af 100644 --- a/nasm.c +++ b/nasm.c @@ -128,7 +128,7 @@ static struct RAA *offsets; static struct SAA *forwrefs; /* keep track of forward references */ static const struct forwrefinfo *forwref; -static struct preproc_ops *preproc; +static const struct preproc_ops *preproc; #define OP_NORMAL (1u << 0) #define OP_PREPROCESS (1u << 1) @@ -1876,12 +1876,11 @@ static void nasm_verror_gnu(int severity, const char *fmt, va_list ap) return; if (!(severity & ERR_NOFILE)) - src_get(&lineno, ¤tfile); + src_get(&lineno, ¤tfile); if (!skip_this_pass(severity)) { if (currentfile) { fprintf(error_file, "%s:%"PRId32": ", currentfile, lineno); - nasm_free(currentfile); } else { fputs("nasm: ", error_file); } @@ -2002,7 +2001,7 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args) } vsnprintf(msg, sizeof msg - 64, fmt, args); - if (severity & ERR_WARN_MASK) { + if ((severity & (ERR_WARN_MASK|ERR_PP_LISTMACRO)) == ERR_WARN_MASK) { char *p = strchr(msg, '\0'); snprintf(p, 64, " [-w+%s]", warnings[WARN_IDX(severity)].name); } @@ -2010,6 +2009,10 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args) if (!skip_this_pass(severity)) fprintf(error_file, "%s%s\n", pfx, msg); + /* Are we recursing from error_list_macros? */ + if (severity & ERR_PP_LISTMACRO) + return; + /* * Don't suppress this with skip_this_pass(), or we don't get * pass1 or preprocessor warnings in the list file @@ -2020,6 +2023,8 @@ static void nasm_verror_common(int severity, const char *fmt, va_list args) if (severity & ERR_USAGE) want_usage = true; + preproc->error_list_macros(severity); + switch (severity & ERR_MASK) { case ERR_DEBUG: /* no further action, by definition */ diff --git a/nasm.h b/nasm.h index aa2409b..663cc21 100644 --- a/nasm.h +++ b/nasm.h @@ -342,10 +342,13 @@ struct preproc_ops { /* Include path from command line */ void (*include_path)(char *path); + + /* Unwind the macro stack when printing an error message */ + void (*error_list_macros)(int severity); }; -extern struct preproc_ops nasmpp; -extern struct preproc_ops preproc_nop; +extern const struct preproc_ops nasmpp; +extern const struct preproc_ops preproc_nop; /* * Some lexical properties of the NASM source language, included diff --git a/nasmlib.c b/nasmlib.c index a1a3191..2bea64b 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -570,6 +570,12 @@ int32_t src_set_linnum(int32_t newline) return oldline; } +/* This returns a pointer, not a copy, to the current fname */ +const char *src_get_fname(void) +{ + return file_name; +} + int32_t src_get_linnum(void) { return line_number; diff --git a/nasmlib.h b/nasmlib.h index d307f77..08b2dc3 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -107,6 +107,7 @@ static inline vefunc nasm_set_verror(vefunc ve) #define ERR_NO_SEVERITY 0x00000100 /* suppress printing severity */ #define ERR_PP_PRECOND 0x00000200 /* for preprocessor use */ +#define ERR_PP_LISTMACRO 0x00000400 /* from preproc->error_list_macros() */ /* * These codes define specific types of suppressible warning. @@ -392,6 +393,7 @@ int bsi(const char *string, const char **array, int size); int bsii(const char *string, const char **array, int size); char *src_set_fname(char *newname); +const char *src_get_fname(void); int32_t src_set_linnum(int32_t newline); int32_t src_get_linnum(void); /* diff --git a/preproc-nop.c b/preproc-nop.c index 8024cac..f8513a8 100644 --- a/preproc-nop.c +++ b/preproc-nop.c @@ -1,6 +1,6 @@ /* ----------------------------------------------------------------------- * * - * Copyright 1996-2012 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. * @@ -170,7 +170,12 @@ static void nop_include_path(char *path) (void)path; } -struct preproc_ops preproc_nop = { +static void nop_error_list_macros(int severity) +{ + (void)severity; +} + +const struct preproc_ops preproc_nop = { nop_reset, nop_getline, nop_cleanup, @@ -178,5 +183,6 @@ struct preproc_ops preproc_nop = { nop_pre_define, nop_pre_undefine, nop_pre_include, - nop_include_path + nop_include_path, + nop_error_list_macros, }; diff --git a/preproc.c b/preproc.c index 9576fe9..fa2dcaf 100644 --- a/preproc.c +++ b/preproc.c @@ -155,6 +155,9 @@ struct MMacro { uint64_t unique; int lineno; /* Current line number on expansion */ uint64_t condcnt; /* number of if blocks... */ + + char *fname; /* File where defined */ + int32_t xline; /* First line in macro */ }; @@ -625,6 +628,7 @@ static void free_mmacro(MMacro * m) free_tlist(m->dlist); nasm_free(m->defaults); free_llist(m->expansion); + nasm_free(m->fname); nasm_free(m); } @@ -2738,7 +2742,7 @@ issue_error: pp_directives[i]); return DIRECTIVE_FOUND; } - defining = nasm_malloc(sizeof(MMacro)); + defining = nasm_zalloc(sizeof(MMacro)); defining->max_depth = (i == PP_RMACRO) || (i == PP_IRMACRO) ? DEADMAN_LIMIT : 0; defining->casesense = (i == PP_MACRO) || (i == PP_RMACRO); @@ -2748,6 +2752,8 @@ issue_error: return DIRECTIVE_FOUND; } + src_get(&defining->xline, &defining->fname); + mmac = (MMacro *) hash_findix(&mmacros, defining->name); while (mmac) { if (!strcmp(mmac->name, defining->name) && @@ -5011,7 +5017,7 @@ static char *pp_getline(void) /* only set line and file name if there's a next node */ if (i->next) { src_set_linnum(i->lineno); - nasm_free(src_set_fname(nasm_strdup(i->fname))); + src_set_fname(nasm_strdup(i->fname)); } istk = i->next; lfmt->downlevel(LIST_INCLUDE); @@ -5237,7 +5243,29 @@ static void make_tok_num(Token * tok, int64_t val) tok->type = TOK_NUMBER; } -struct preproc_ops nasmpp = { +static void pp_error_list_macros(int severity) +{ + MMacro *m; + int32_t saved_line; + const char *saved_fname = NULL; + + severity |= ERR_PP_LISTMACRO | ERR_NO_SEVERITY; + saved_line = src_get_linnum(); + saved_fname = src_get_fname(); + + list_for_each(m, istk->mstk) { + if (m->name && !m->nolist) { + src_set_linnum(m->xline + m->lineno); + src_set_fname(m->fname); + nasm_error(severity, "from macro `%s' defined here", m->name); + } + } + + src_set_fname((char *)saved_fname); + src_set_linnum(saved_line); +} + +const struct preproc_ops nasmpp = { pp_reset, pp_getline, pp_cleanup, @@ -5245,5 +5273,6 @@ struct preproc_ops nasmpp = { pp_pre_define, pp_pre_undefine, pp_pre_include, - pp_include_path + pp_include_path, + pp_error_list_macros, }; diff --git a/test/macroerr.asm b/test/macroerr.asm new file mode 100644 index 0000000..5f1c93e --- /dev/null +++ b/test/macroerr.asm @@ -0,0 +1,11 @@ +%include "macroerr.inc" + +%macro bluttan 1 + mov eax,%1 +%endmacro + + bluttan ptr + blej ptr + dd ptr, ptr + +ptr: diff --git a/test/macroerr.inc b/test/macroerr.inc new file mode 100644 index 0000000..f40f7e6 --- /dev/null +++ b/test/macroerr.inc @@ -0,0 +1,3 @@ +%macro blej 1 + mov eax,%1 +%endmacro |