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. H. P. A. <hp...@li...> - 2016-02-23 09:08:57
|
Commit-ID: ed8eb56546a75da8099cfd0f9860b68bcba0aa85 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ed8eb56546a75da8099cfd0f9860b68bcba0aa85 Author: H. Peter Anvin <hp...@li...> AuthorDate: Tue, 23 Feb 2016 00:13:49 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 23 Feb 2016 00:13:49 -0800 outmacho: correctly handle references between sections Correctly generate references between sections. The previous version would work correctly as long as all relative references came from the first section, which is usually __TEXT,__text and so it usually worked. Signed-off-by: H. Peter Anvin <hp...@li...> --- output/outmacho.c | 60 +++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 19 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index e8c1e99..881a4ae 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -179,6 +179,9 @@ struct section { #define S_ATTR_PURE_INSTRUCTIONS 0x80000000 /* section uses pure machine instructions */ +/* Fake section for absolute symbols, *not* part of the section linked list */ +static struct section absolute_sect; + static const struct sectmap { const char *nasmsect; const char *segname; @@ -197,10 +200,10 @@ struct reloc { struct reloc *next; /* data that goes into the file */ - int32_t addr; /* op's offset in section */ - uint32_t snum:24, /* contains symbol index if - ** ext otherwise in-file - ** section number */ + int32_t addr; /* op's offset in section */ + uint32_t snum:24, /* contains symbol index if + ** ext otherwise in-file + ** section number */ pcrel:1, /* relative relocation */ length:2, /* 0=byte, 1=word, 2=int32_t, 3=int64_t */ ext:1, /* external symbol referenced */ @@ -274,8 +277,6 @@ static struct RAA *extsyms; static struct SAA *strs; static uint32_t strslen; -extern struct ofmt of_macho64; - /* Global file information. This should be cleaned up into either a structure or as function arguments. */ static uint32_t head_ncmds = 0; @@ -338,6 +339,9 @@ static void macho_init(void) sects = NULL; sectstail = §s; + /* Fake section for absolute symbols */ + absolute_sect.index = NO_SEG; + syms = NULL; symstail = &syms; nsyms = 0; @@ -376,8 +380,9 @@ static struct symbol *macho_find_gsym(struct section *s, srb = rb_search(s->gsyms, offset); if (!srb || (exact && srb->key != offset)) { - nasm_error(ERR_NONFATAL, "unable to find a suitable global symbol" - " for this reference"); + nasm_error(ERR_NONFATAL, "unable to find a suitable %s symbol" + " for this reference", + s == &absolute_sect ? "absolute" : "global"); return NULL; } @@ -436,21 +441,33 @@ static int64_t add_reloc(struct section *sect, int32_t section, } break; - case RL_BRANCH: - r->type = X86_64_RELOC_BRANCH; - goto rel_or_branch; - case RL_REL: + case RL_BRANCH: r->type = fmt.reloc_rel; - - rel_or_branch: r->pcrel = 1; if (section == NO_SEG) { - goto bail; /* No relocation needed */ + /* absolute - seems to produce garbage no matter what */ + nasm_error(ERR_NONFATAL, "Mach-O does not support relative " + "references to absolute addresses"); + goto bail; +#if 0 + /* This "seems" to be how it ought to work... */ + + struct symbol *sym = macho_find_gsym(&absolute_sect, + offset, false); + if (!sym) + goto bail; + + sect->extreloc = 1; + r->snum = NO_SECT; + adjust = -sect->size; +#endif } else if (fi == NO_SECT) { /* external */ sect->extreloc = 1; r->snum = raa_read(extsyms, section); + if (reltype == RL_BRANCH) + r->type = X86_64_RELOC_BRANCH; } else { /* local */ r->ext = 0; @@ -647,7 +664,7 @@ static void macho_output(int32_t secto, const void *data, saa_fread(s->data, 0, opcode+1, 1); } - if (opcode[1] == 0xe8 || opcode[1] == 0xe9 || + if ((opcode[0] != 0x0f && (opcode[1] & 0xfe) == 0xe8) || (opcode[0] == 0x0f && (opcode[1] & 0xf0) == 0x80)) { /* Direct call, jmp, or jcc */ reltype = RL_BRANCH; @@ -821,7 +838,8 @@ static int32_t macho_section(char *name, int pass, int *bits) s->align = newAlignment; } else if (!nasm_stricmp("data", currentAttribute)) { flags = S_REGULAR; - } else if (!nasm_stricmp("code", currentAttribute)) { + } else if (!nasm_stricmp("code", currentAttribute) || + !nasm_stricmp("text", currentAttribute)) { flags = S_REGULAR | S_ATTR_SOME_INSTRUCTIONS | S_ATTR_PURE_INSTRUCTIONS; } else if (!nasm_stricmp("mixed", currentAttribute)) { @@ -898,6 +916,9 @@ static void macho_symdef(char *name, int32_t section, int64_t offset, /* symbols in no section get absolute */ sym->type |= N_ABS; sym->sect = NO_SECT; + + /* all absolute symbols are available to use as references */ + absolute_sect.gsyms = rb_insert(absolute_sect.gsyms, &sym->symv); } else { struct section *s = get_section_by_index(section); @@ -1103,7 +1124,6 @@ static void macho_calculate_sizes (void) * perhaps aligning to pointer size would be better. */ s->pad = ALIGN(seg_filesize, 4) - seg_filesize; - // s->pad = ALIGN(seg_filesize, 1U << s->align) - seg_filesize; s->offset = seg_filesize + s->pad; seg_filesize += s->size + s->pad; } @@ -1128,7 +1148,7 @@ static void macho_calculate_sizes (void) /* Create a table of sections by file index to avoid linear search */ sectstab = nasm_malloc((seg_nsects + 1) * sizeof(*sectstab)); - sectstab[0] = NULL; + sectstab[NO_SECT] = &absolute_sect; for (s = sects, fi = 1; s != NULL; s = s->next, fi++) sectstab[fi] = s; } @@ -1302,6 +1322,8 @@ static void macho_write_section (void) /* generate final address by section address and offset */ nasm_assert(r->snum <= seg_nsects); l += sectstab[r->snum]->addr; + if (r->pcrel) + l -= s->addr; } /* write new offset back */ |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-23 09:08:55
|
Commit-ID: d015a9f39e9a0fc2e42dd733b480f3b7c433cb3c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d015a9f39e9a0fc2e42dd733b480f3b7c433cb3c Author: H. Peter Anvin <hp...@li...> AuthorDate: Tue, 23 Feb 2016 00:26:26 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Tue, 23 Feb 2016 00:26:26 -0800 NASM 2.12rc7 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index ab30d27..81c0dc3 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.12rc6 +2.12rc7 |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-22 05:24:17
|
Commit-ID: ec82d7a92b6b36ee82a051ac437d5206971e179b Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ec82d7a92b6b36ee82a051ac437d5206971e179b Author: H. Peter Anvin <hp...@zy...> AuthorDate: Sun, 21 Feb 2016 21:20:45 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sun, 21 Feb 2016 21:20:45 -0800 configure: smarter way to handle fseeko() searching Better handling of the replacement for fseeko() in its absence; also look for the Windows _fseeki64() function. Signed-off-by: H. Peter Anvin <hp...@zy...> --- compiler.h | 14 ++++++++++++++ configure.in | 2 +- nasmlib.c | 5 ----- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/compiler.h b/compiler.h index 4b29d36..310e79b 100644 --- a/compiler.h +++ b/compiler.h @@ -99,6 +99,20 @@ int vsnprintf(char *, size_t, const char *, va_list); # endif #endif +/* Missing fseeko/ftello */ +#ifndef HAVE_FSEEKO +# undef off_t /* Just in case it is a macro */ +# ifdef HAVE__FSEEKI64 +# define fseeko _fseeki64 +# define ftello _ftelli64 +# define off_t int64_t +# else +# define fseeko fseek +# define ftello ftell +# define off_t long +# endif +#endif + #if !defined(HAVE_STRLCPY) || !HAVE_DECL_STRLCPY size_t strlcpy(char *, const char *, size_t); #endif diff --git a/configure.in b/configure.in index 38306c2..e05811a 100644 --- a/configure.in +++ b/configure.in @@ -139,8 +139,8 @@ AC_CHECK_FUNCS(canonicalize_file_name) AC_CHECK_FUNCS(_fullpath) AC_CHECK_FUNCS(pathconf) -AC_TYPE_OFF_T AC_FUNC_FSEEKO +AC_CHECK_FUNCS([_fseeki64]) AC_CHECK_FUNCS([ftruncate _chsize _chsize_s]) AC_CHECK_FUNCS([fileno]) diff --git a/nasmlib.c b/nasmlib.c index eb0217d..41da9f0 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -459,11 +459,6 @@ void fwriteaddr(uint64_t data, int size, FILE * fp) #endif -#ifndef HAVE_FSEEKO -# define fseeko fseek -# define ftello ftell -#endif - #ifdef HAVE_FILENO /* Useless without fileno() */ # ifdef HAVE__CHSIZE_S # define nasm_ftruncate(fd,size) _chsize_s(fd,size) |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-22 05:09:38
|
Commit-ID: 1ac2c2f55fab3fed6ca5b95dbea5fe63dec6bc9e Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=1ac2c2f55fab3fed6ca5b95dbea5fe63dec6bc9e Author: H. Peter Anvin <hp...@zy...> AuthorDate: Sun, 21 Feb 2016 21:07:11 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sun, 21 Feb 2016 21:07:11 -0800 misc/tag-release: default to --no-push --no-push is by far the safer default. Signed-off-by: H. Peter Anvin <hp...@zy...> --- misc/tag-release | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/misc/tag-release b/misc/tag-release index 331e51a..9e3a0bd 100755 --- a/misc/tag-release +++ b/misc/tag-release @@ -3,10 +3,9 @@ version="" repo="" branch="" -push=1 +push=0 -for opt in $* -do +for opt; do case "$opt" in --ver=*) version=`echo $opt | sed 's/[-a-zA-Z0-9]*=//'` @@ -17,6 +16,9 @@ do --branch=*) branch=`echo $opt | sed 's/[-a-zA-Z0-9]*=//'` ;; + --push) + push=1 + ;; --no-push) push=0 ;; |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-22 05:09:19
|
Commit-ID: d4e001db67531894ba402bf04bc44c00c203dc6d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=d4e001db67531894ba402bf04bc44c00c203dc6d Author: H. Peter Anvin <hp...@zy...> AuthorDate: Sun, 21 Feb 2016 21:07:35 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sun, 21 Feb 2016 21:07:35 -0800 NASM 2.12rc6 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 202fbf6..ab30d27 100644 --- a/version +++ b/version @@ -1 +1 @@ ---rel=2.12rc6 +2.12rc6 |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-22 05:09:18
|
Commit-ID: 021b10ca14984d8da244258ae2dbcbefe142aa82 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=021b10ca14984d8da244258ae2dbcbefe142aa82 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Sun, 21 Feb 2016 21:05:16 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sun, 21 Feb 2016 21:05:16 -0800 misc/tag-release: die on unknown options If someone specifies an unknown option, they proabably typoed something. Signed-off-by: H. Peter Anvin <hp...@zy...> --- misc/tag-release | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/misc/tag-release b/misc/tag-release index 62e3eba..331e51a 100755 --- a/misc/tag-release +++ b/misc/tag-release @@ -20,6 +20,10 @@ do --no-push) push=0 ;; + -*) + echo "Invalid option: $opt" 1>&2 + exit 1 + ;; *) version=$opt ;; |
From: nasm-bot f. H. P. A. <hp...@zy...> - 2016-02-22 05:09:18
|
Commit-ID: 408b200684cbf19c3deee83ce33684aa2c8f08c0 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=408b200684cbf19c3deee83ce33684aa2c8f08c0 Author: H. Peter Anvin <hp...@zy...> AuthorDate: Sun, 21 Feb 2016 21:03:47 -0800 Committer: H. Peter Anvin <hp...@zy...> CommitDate: Sun, 21 Feb 2016 21:03:47 -0800 NASM --rel=2.12rc6 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 38e6cc5..202fbf6 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.12rc5 +--rel=2.12rc6 |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-22 05:00:18
|
Commit-ID: a222d2113830237bdb7cc7280108528d95530a8c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a222d2113830237bdb7cc7280108528d95530a8c Author: H. Peter Anvin <hp...@li...> AuthorDate: Sun, 21 Feb 2016 20:56:19 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Sun, 21 Feb 2016 20:56:19 -0800 outmacho: make a best effort at separating SIGNED from BRANCH relocs For 64 bits, a BRANCH reloc is sometimes needed to fix up PIC problems. Make a best effort at generating BRANCH relocs just as we make a best effort at distinguishing GOTLOAD from GOT. This needs to be replaced with information from the assembler to the backend. Signed-off-by: H. Peter Anvin <hp...@li...> --- output/outmacho.c | 63 ++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 46 insertions(+), 17 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 6179cc7..e8c1e99 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -111,6 +111,7 @@ enum reltype { RL_ABS, /* Absolute relocation */ RL_REL, /* Relative relocation */ RL_TLV, /* Thread local */ + RL_BRANCH, /* Relative direct branch */ RL_SUB, /* X86_64_RELOC_SUBTRACT */ RL_GOT, /* X86_64_RELOC_GOT */ RL_GOTLOAD, /* X86_64_RELOC_GOT_LOAD */ @@ -435,8 +436,14 @@ static int64_t add_reloc(struct section *sect, int32_t section, } break; + case RL_BRANCH: + r->type = X86_64_RELOC_BRANCH; + goto rel_or_branch; + case RL_REL: r->type = fmt.reloc_rel; + + rel_or_branch: r->pcrel = 1; if (section == NO_SEG) { goto bail; /* No relocation needed */ @@ -508,8 +515,9 @@ static void macho_output(int32_t secto, const void *data, { struct section *s; int64_t addr, offset; - uint8_t mydata[16], *p, gotload; + uint8_t mydata[16], *p; bool is_bss; + enum reltype reltype; if (secto == NO_SEG) { if (type != OUT_RESERVE) @@ -620,35 +628,56 @@ static void macho_output(int32_t secto, const void *data, p = mydata; offset = *(int64_t *)data; addr = offset - size; + reltype = RL_REL; if (section != NO_SEG && section % 2) { nasm_error(ERR_NONFATAL, "Mach-O format does not support" " section base references"); } else if (wrt == NO_SEG) { - /* Plain relative relocation */ - addr += add_reloc(s, section, offset, RL_REL, 4); - } else if (wrt == macho_gotpcrel_sect) { - if (s->data->datalen > 1) { - /* Retrieve instruction opcode */ - saa_fread(s->data, s->data->datalen-2, &gotload, 1); - } else { - gotload = 0; + if (fmt.ptrsize == 8 && + (s->flags & S_ATTR_SOME_INSTRUCTIONS)) { + uint8_t opcode[2]; + + opcode[0] = opcode[1] = 0; + + /* HACK: Retrieve instruction opcode */ + if (likely(s->data->datalen >= 2)) { + saa_fread(s->data, s->data->datalen-2, opcode, 2); + } else if (s->data->datalen == 1) { + saa_fread(s->data, 0, opcode+1, 1); + } + + if (opcode[1] == 0xe8 || opcode[1] == 0xe9 || + (opcode[0] == 0x0f && (opcode[1] & 0xf0) == 0x80)) { + /* Direct call, jmp, or jcc */ + reltype = RL_BRANCH; + } } - if (gotload == 0x8B) { - /* Check for MOVQ Opcode -> X86_64_RELOC_GOT_LOAD */ - addr += add_reloc(s, section, offset, RL_GOTLOAD, 4); - } else { - /* X86_64_RELOC_GOT */ - addr += add_reloc(s, section, offset, RL_GOT, 4); + } else if (wrt == macho_gotpcrel_sect) { + reltype = RL_GOT; + + if ((s->flags & S_ATTR_SOME_INSTRUCTIONS) && + s->data->datalen >= 3) { + uint8_t gotload[3]; + + /* HACK: Retrieve instruction opcode */ + saa_fread(s->data, s->data->datalen-3, gotload, 3); + if ((gotload[0] & 0xf8) == 0x48 && + gotload[1] == 0x8b && + (gotload[2] & 0307) == 0005) { + /* movq <reg>,[rel sym wrt ..gotpcrel] */ + reltype = RL_GOTLOAD; + } } } else if (wrt == macho_tlvp_sect) { - addr += add_reloc(s, section, offset, RL_TLV, 4); + reltype = RL_TLV; } else { nasm_error(ERR_NONFATAL, "Mach-O format does not support" " this use of WRT"); - wrt = NO_SEG; /* we can at least _try_ to continue */ + /* continue with RL_REL */ } + addr += add_reloc(s, section, offset, reltype, 4); WRITELONG(p, addr); sect_write(s, mydata, 4); break; |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 22:42:17
|
Commit-ID: 73b22f5c1c8372bc5fc64962d38a75e9d6998f69 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=73b22f5c1c8372bc5fc64962d38a75e9d6998f69 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 14:40:37 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 14:40:37 -0800 Windows portability fixes Windows needs strsep() and defines a P_WAIT constant that we need to undefine. Signed-off-by: H. Peter Anvin <hp...@li...> --- configure.in | 2 +- nasm.h | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.in b/configure.in index 98e151c..38306c2 100644 --- a/configure.in +++ b/configure.in @@ -129,6 +129,7 @@ AC_CHECK_FUNCS(strspn, , AC_CHECK_FUNCS(strcasecmp stricmp) AC_CHECK_FUNCS(strncasecmp strnicmp) +AC_CHECK_FUNCS(strsep) AC_CHECK_FUNCS(getuid) AC_CHECK_FUNCS(getgid) @@ -153,7 +154,6 @@ AC_SUBST([LIBOBJDIR], [lib/]) PA_REPLACE_FUNC([vsnprintf _vsnprintf]) PA_REPLACE_FUNC([snprintf _snprintf]) PA_REPLACE_FUNC([strlcpy]) -PA_REPLACE_FUNC([strsep]) dnl Check for functions that might not be declared in the headers for dnl various idiotic reasons (mostly because of library authors diff --git a/nasm.h b/nasm.h index 517d924..9e4fa96 100644 --- a/nasm.h +++ b/nasm.h @@ -479,6 +479,10 @@ enum vex_class { * prefixes, we must ensure the enumerations for prefixes and * register names do not overlap. */ +#ifdef P_WAIT +# undef P_WAIT /* Macro defined on some Windows versions */ +#endif + enum prefixes { /* instruction prefixes */ P_none = 0, PREFIX_ENUM_START = REG_ENUM_LIMIT, |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 22:30:18
|
Commit-ID: e65e81b172ceed17621c0f0ca4392a531018071e Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=e65e81b172ceed17621c0f0ca4392a531018071e Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 14:24:40 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 14:24:40 -0800 nasmlib: allow writing of sparse files On systems that support it, allow the writing of sparse files. This can be useful for some file formats (like binary, or ELF if the alignments are very large) that can contain large amounts of zeroes. This is not inherently portable code, so condition it on certain known systems. Signed-off-by: H. Peter Anvin <hp...@li...> --- configure.in | 8 ++++++++ nasmlib.c | 29 ++++++++++++++++++++++++++++- nasmlib.h | 8 +++++++- 3 files changed, 43 insertions(+), 2 deletions(-) diff --git a/configure.in b/configure.in index e762777..98e151c 100644 --- a/configure.in +++ b/configure.in @@ -111,6 +111,9 @@ AC_CHECK_HEADERS(strings.h) dnl Look for <stdbool.h> AC_HEADER_STDBOOL +dnl Look for <io.h> +AC_CHECK_HEADERS(io.h) + dnl Look for <unistd.h> AC_CHECK_HEADERS(unistd.h) @@ -135,6 +138,11 @@ AC_CHECK_FUNCS(canonicalize_file_name) AC_CHECK_FUNCS(_fullpath) AC_CHECK_FUNCS(pathconf) +AC_TYPE_OFF_T +AC_FUNC_FSEEKO +AC_CHECK_FUNCS([ftruncate _chsize _chsize_s]) +AC_CHECK_FUNCS([fileno]) + PA_HAVE_FUNC(__builtin_ctz, (0U)) PA_HAVE_FUNC(__builtin_ctzl, (0UL)) PA_HAVE_FUNC(__builtin_ctzll, (0ULL)) diff --git a/nasmlib.c b/nasmlib.c index 49f1e47..eb0217d 100644 --- a/nasmlib.c +++ b/nasmlib.c @@ -165,7 +165,7 @@ no_return nasm_assert_failed(const char *file, int line, const char *msg) void nasm_write(const void *ptr, size_t size, FILE *f) { size_t n = fwrite(ptr, 1, size, f); - if (n != size) + if (n != size || ferror(f) || feof(f)) nasm_error(ERR_FATAL, "unable to write output: %s", strerror(errno)); } @@ -459,10 +459,37 @@ void fwriteaddr(uint64_t data, int size, FILE * fp) #endif +#ifndef HAVE_FSEEKO +# define fseeko fseek +# define ftello ftell +#endif + +#ifdef HAVE_FILENO /* Useless without fileno() */ +# ifdef HAVE__CHSIZE_S +# 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) +# define nasm_ftruncate(fd,size) ftruncate(fd,size) +# endif +#endif + void fwritezero(size_t bytes, FILE *fp) { size_t blksize; +#ifdef nasm_ftruncate + if (bytes >= BUFSIZ && !ferror(fp) && !feof(fp)) { + off_t pos = ftello(fp); + if (pos >= 0) { + if (!fflush(fp) && + !nasm_ftruncate(fileno(fp), pos + bytes) && + !fseeko(fp, pos+bytes, SEEK_SET)) + return; + } + } +#endif + while (bytes) { blksize = (bytes < ZERO_BUF_SIZE) ? bytes : ZERO_BUF_SIZE; diff --git a/nasmlib.h b/nasmlib.h index 96c488a..534324d 100644 --- a/nasmlib.h +++ b/nasmlib.h @@ -44,7 +44,13 @@ #include <stdio.h> #include <string.h> #ifdef HAVE_STRINGS_H -#include <strings.h> +# include <strings.h> +#endif +#ifdef HAVE_IO_H +# include <io.h> +#endif +#ifdef HAVE_UNISTD_H +# include <unistd.h> #endif /* |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 21:09:21
|
Commit-ID: 114ba75f7bb6dbd935b8b72537544d8e8ec49716 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=114ba75f7bb6dbd935b8b72537544d8e8ec49716 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 13:06:04 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 13:06:04 -0800 test/Makefile: add a rule for nasm itself If NASM needs to be rebuilt, build it in the proper directory. Signed-off-by: H. Peter Anvin <hp...@li...> --- test/Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/Makefile b/test/Makefile index 8b51359..a76044d 100644 --- a/test/Makefile +++ b/test/Makefile @@ -5,6 +5,9 @@ NASMOPT = -Ox -I../misc $(OPT) PERL = perl TESTS = $(wildcard *.asm) +$(NASM): + $(MAKE) -C .. + %.bin: %.asm $(NASM) $(NASM) $(NASMOPT) -f bin -o $@ -l $*.lst $< |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 20:12:20
|
Commit-ID: 44a609b203734f7b76ab4fbb80e6d17cb0884151 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=44a609b203734f7b76ab4fbb80e6d17cb0884151 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 12:09:31 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 12:09:31 -0800 configure.in: add --enable-werror option Add an option to compile with -Werror, useful for development. Change --with-ccache to --enable-ccache to match guidelines. Signed-off-by: H. Peter Anvin <hp...@li...> --- configure.in | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/configure.in b/configure.in index 5164f4d..6319206 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf 2.61 or later to produce dnl a configure script. -AC_PREREQ(2.61) +AC_PREREQ(2.63) AC_INIT(config.h.in) AC_CONFIG_HEADERS(config.h) @@ -176,14 +176,17 @@ fi dnl dnl support cchace dnl -AC_ARG_WITH([ccache], - [AC_HELP_STRING([--with-ccache], - [Compile with ccache])], - [CC="ccache $CC"], - []) +AC_ARG_ENABLE([ccache], +[AC_HELP_STRING([--with-ccache], [compile with ccache])], +[CC="ccache $CC"], +[]) PA_ADD_CFLAGS([-pedantic]) -PA_ADD_CFLAGS([-Werror=implicit]) +AC_ARG_ENABLE([werror], +[AC_HELP_STRING([--enable-werror], +[compile with -Werror to error out on any warning])], +[PA_ADD_CFLAGS([-Werror])], +[PA_ADD_CFLAGS([-Werror=implicit]) PA_ADD_CFLAGS([-Werror=missing-braces]) PA_ADD_CFLAGS([-Werror=return-type]) PA_ADD_CFLAGS([-Werror=trigraphs]) @@ -192,7 +195,7 @@ PA_ADD_CFLAGS([-Werror=strict-prototypes]) PA_ADD_CFLAGS([-Werror=missing-prototypes]) PA_ADD_CFLAGS([-Werror=missing-declarations]) PA_ADD_CFLAGS([-Werror=comment]) -PA_ADD_CFLAGS([-Werror=vla]) +PA_ADD_CFLAGS([-Werror=vla])]) AC_OUTPUT_COMMANDS([mkdir -p output]) AC_OUTPUT(Makefile rdoff/Makefile doc/Makefile) |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 20:12:20
|
Commit-ID: b423c02ad2fa97310ea72968540e38e70d73c43e Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b423c02ad2fa97310ea72968540e38e70d73c43e Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 11:57:53 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 11:57:53 -0800 Platform compatibility improvements Windows: indicate that we support multibyte character sets in file names. Unix: support gigantic input and output files. Might be useful especially in the presence of the INCBIN directive. Signed-off-by: H. Peter Anvin <hp...@li...> --- compiler.h | 3 +++ configure.in | 1 + 2 files changed, 4 insertions(+) diff --git a/compiler.h b/compiler.h index e9022f8..4a68576 100644 --- a/compiler.h +++ b/compiler.h @@ -48,6 +48,9 @@ # undef __STRICT_ANSI__ #endif +/* On Microsoft platforms we support multibyte character sets in filenames */ +#define _MBCS 1 + #ifdef HAVE_CONFIG_H # include "config.h" /* autoconf doesn't define these if they are redundant, but we want to diff --git a/configure.in b/configure.in index 023bd24..5164f4d 100644 --- a/configure.in +++ b/configure.in @@ -49,6 +49,7 @@ AC_PREFIX_PROGRAM(nasm) dnl Checks for programs. dnl Consider AC_USE_SYSTEM_EXTENSIONS if autoconf 2.61 is OK in the future AC_USE_SYSTEM_EXTENSIONS +AC_SYS_LARGEFILE AC_PROG_CC AC_PROG_LN_S AC_PROG_MAKE_SET |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 19:51:41
|
Commit-ID: 5f0e601f9890e4dc85245c2f2b4178e051c97ea5 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=5f0e601f9890e4dc85245c2f2b4178e051c97ea5 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 11:48:12 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 11:48:12 -0800 doc/rdsrc.pl: escape braces in regular expression to support newer Perl Newer versions of Perl require literal braces in regular expressions to be escaped. Signed-off-by: H. Peter Anvin <hp...@li...> --- doc/rdsrc.pl | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/doc/rdsrc.pl b/doc/rdsrc.pl index de3a862..21ec6e7 100644 --- a/doc/rdsrc.pl +++ b/doc/rdsrc.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. ## @@ -249,8 +249,8 @@ sub got_para { while (/^\\c (([^\\]|\\[^c])*)(.*)$/) { $l = $1; $_ = $3; - $l =~ s/\\{/{/g; - $l =~ s/\\}/}/g; + $l =~ s/\\\{/\{/g; + $l =~ s/\\\}/}/g; $l =~ s/\\\\/\\/g; push @$pname, $l; } @@ -263,7 +263,7 @@ sub got_para { $snum = 0; $xref = "chapter-$cnum"; $pflags = "chap $cnum :$xref"; - die "badly formatted chapter heading: $_\n" if !/^\\C{([^}]*)}\s*(.*)$/; + die "badly formatted chapter heading: $_\n" if !/^\\C\{([^\}]*)\}\s*(.*)$/; $refs{$1} = "chapter $cnum"; $node = "Chapter $cnum"; &add_item($node, 1); @@ -280,7 +280,7 @@ sub got_para { $snum = 0; $xref = "appendix-$cnum"; $pflags = "appn $cnum :$xref"; - die "badly formatted appendix heading: $_\n" if !/^\\A{([^}]*)}\s*(.*)$/; + die "badly formatted appendix heading: $_\n" if !/^\\A\{([^\}]*)}\s*(.*)$/; $refs{$1} = "appendix $cnum"; $node = "Appendix $cnum"; &add_item($node, 1); @@ -294,7 +294,7 @@ sub got_para { $snum = 0; $xref = "section-$cnum.$hnum"; $pflags = "head $cnum.$hnum :$xref"; - die "badly formatted heading: $_\n" if !/^\\[HP]{([^}]*)}\s*(.*)$/; + die "badly formatted heading: $_\n" if !/^\\[HP]{([^\}]*)}\s*(.*)$/; $refs{$1} = "section $cnum.$hnum"; $node = "Section $cnum.$hnum"; &add_item($node, 2); @@ -307,7 +307,7 @@ sub got_para { $snum++; $xref = "section-$cnum.$hnum.$snum"; $pflags = "subh $cnum.$hnum.$snum :$xref"; - die "badly formatted subheading: $_\n" if !/^\\S{([^}]*)}\s*(.*)$/; + die "badly formatted subheading: $_\n" if !/^\\S\{([^\}]*)\}\s*(.*)$/; $refs{$1} = "section $cnum.$hnum.$snum"; $node = "Section $cnum.$hnum.$snum"; &add_item($node, 3); @@ -317,18 +317,18 @@ sub got_para { # the standard word-by-word code will happen next } elsif (/^\\IR/) { # An index-rewrite. - die "badly formatted index rewrite: $_\n" if !/^\\IR{([^}]*)}\s*(.*)$/; + die "badly formatted index rewrite: $_\n" if !/^\\IR\{([^\}]*)\}\s*(.*)$/; $irewrite = $1; $_ = $2; # the standard word-by-word code will happen next } elsif (/^\\IA/) { # An index-alias. - die "badly formatted index alias: $_\n" if !/^\\IA{([^}]*)}{([^}]*)}\s*$/; + die "badly formatted index alias: $_\n" if !/^\\IA\{([^\}]*)}\{([^\}]*)\}\s*$/; $idxalias{$1} = $2; return; # avoid word-by-word code } elsif (/^\\M/) { # Metadata - die "badly formed metadata: $_\n" if !/^\\M{([^}]*)}{([^}]*)}\s*$/; + die "badly formed metadata: $_\n" if !/^\\M\{([^\}]*)}\{([^\}]*)\}\s*$/; $metadata{$1} = $2; return; # avoid word-by-word code } elsif (/^\\b/) { @@ -374,11 +374,11 @@ sub got_para { $qindex = 1 if $1 eq "\\I"; $indexing = 1, s/^\\[iI]// if $1; s/^\\c//; - die "badly formatted \\c: \\c$_\n" if !/{(([^\\}]|\\.)*)}(.*)$/; + die "badly formatted \\c: \\c$_\n" if !/\{(([^\\}]|\\.)*)\}(.*)$/; $w = $1; $_ = $3; - $w =~ s/\\{/{/g; - $w =~ s/\\}/}/g; + $w =~ s/\\\{/\{/g; + $w =~ s/\\\}/\}/g; $w =~ s/\\-/-/g; $w =~ s/\\\\/\\/g; (push @$pname,"i"),$lastp = $#$pname if $indexing; @@ -391,11 +391,11 @@ sub got_para { $indexing = 1, $type = "\\i" if $1; $emph = 1, $type = "\\e" if $2; s/^(\\[iI])?(\\e?)//; - die "badly formatted $type: $type$_\n" if !/{(([^\\}]|\\.)*)}(.*)$/; + die "badly formatted $type: $type$_\n" if !/\{(([^\\}]|\\.)*)\}(.*)$/; $w = $1; $_ = $3; - $w =~ s/\\{/{/g; - $w =~ s/\\}/}/g; + $w =~ s/\\\{/\{/g; + $w =~ s/\\\}/\}/g; $w =~ s/\\-/-/g; $w =~ s/\\\\/\\/g; $t = $emph ? "es" : "n "; @@ -418,21 +418,21 @@ sub got_para { $t = "k "; $t = "kK" if /^\\K/; s/^\\[kK]//; - die "badly formatted \\k: \\c$_\n" if !/{([^}]*)}(.*)$/; + die "badly formatted \\k: \\k$_\n" if !/\{([^\}]*)\}(.*)$/; $_ = $2; push @$pname,"$t$1"; } elsif (/^\\W/) { s/^\\W//; die "badly formatted \\W: \\W$_\n" - if !/{([^}]*)}(\\i)?(\\c)?{(([^\\}]|\\.)*)}(.*)$/; + if !/\{([^\}]*)\}(\\i)?(\\c)?\{(([^\\}]|\\.)*)\}(.*)$/; $l = $1; $w = $4; $_ = $6; $t = "w "; $t = "wc" if $3 eq "\\c"; $indexing = 1 if $2; - $w =~ s/\\{/{/g; - $w =~ s/\\}/}/g; + $w =~ s/\\\{/\{/g; + $w =~ s/\\\}/\}/g; $w =~ s/\\-/-/g; $w =~ s/\\\\/\\/g; (push @$pname,"i"),$lastp = $#$pname if $indexing; @@ -443,8 +443,8 @@ sub got_para { die "painful death! $_\n" if !length $1; $w = $1; $_ = $3; - $w =~ s/\\{/{/g; - $w =~ s/\\}/}/g; + $w =~ s/\\\{/\{/g; + $w =~ s/\\\}/\}/g; $w =~ s/\\-/-/g; $w =~ s/\\\\/\\/g; if ($w eq "-") { |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 19:51:28
|
Commit-ID: 277308f1f3cbd6dba09e560998f7dca7fa7aeaf3 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=277308f1f3cbd6dba09e560998f7dca7fa7aeaf3 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 11:49:33 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 11:49:33 -0800 doc: update documentation for a version 2.12 release Add documentation updates for version 2.12. Signed-off-by: H. Peter Anvin <hp...@li...> --- doc/changes.src | 20 ++++++++----- doc/nasmdoc.src | 89 ++++++++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 85 insertions(+), 24 deletions(-) diff --git a/doc/changes.src b/doc/changes.src index eab8439..94ddb9c 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,12 +9,15 @@ since 2007. \S{cl-2.12} Version 2.12 -\b Huge rework of \c{macho} backend (\k{Mach-O}), internal unification - of 32 and 64 bit formats and make NASM to handle section - alignment properly. +\b Major fixes to the \c{macho} backend (\k{machofmt}); earlier versions + would produce invalid symbols and relocations on a regular basis. + +\b Support for thread-local storage in Mach-O. + +\b Support for arbitrary sections in Mach-O. \b Fix wrong negative size treated as a big positive value passed into - backend causing nasm to crash. + backend causing NASM to crash. \b Fix handling of zero-extending unsigned relocations, we have been printing wrong message and forgot to assign segment with predefined value before @@ -25,16 +28,19 @@ since 2007. \b Portability fixes for building NASM with LLVM compiler. -\b Add support of Codeview (\c{cv8}) debug format for \c{win32} and \c{win64} - formats in the \c{COFF} backend (\k{coff}). +\b Add support of Codeview version 8 (\c{cv8}) debug format for + \c{win32} and \c{win64} formats in the \c{COFF} backend, + see \k{codeview}. \b Allow 64-bit outputs in 16/32-bit only backends. Unsigned 64-bit relocations are zero-extended from 32-bits with a warning - (suppressible via \c{}); signed 64-bit relocations are an arror. + (suppressible via \c{-w-zext-reloc}); signed 64-bit relocations are + an arror. \b Line numbers in list files now correspond to the lines in the source files, instead of simply being sequential. + \S{cl-2.11.09} Version 2.11.09 \b Fix potential stack overwrite in \c{macho32} backend. diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 00a1a14..23a273b 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -140,6 +140,7 @@ variables \IA{case-sensitive}{case sensitive} \IA{case-insensitive}{case sensitive} \IA{character constants}{character constant} +\IR{codeview} CodeView debugging format \IR{common object file format} Common Object File Format \IR{common variables, alignment in elf} common variables, alignment in \c{elf} @@ -187,7 +188,8 @@ convention \IR{logical or} logical OR \IR{logical xor} logical XOR \IR{mach object file format} Mach, object file format -\IR{mach-o} Mach-O +\IA{mach-o}{macho} +\IR{mach-o} Mach-O, object file format \IR{macho32} \c{macho32} \IR{macho64} \c{macho64} \IR{macos x} MacOS X @@ -232,6 +234,7 @@ Object File Format \IR{section alignment, in obj} section alignment, in \c{obj} \IR{section alignment, in win32} section alignment, in \c{win32} \IR{section, elf extensions to} \c{SECTION}, \c{elf} extensions to +\IR{section, macho extensions to} \c{SECTION}, \c{macho} extensions to \IR{section, win32 extensions to} \c{SECTION}, \c{win32} extensions to \IR{segment alignment, in bin} segment alignment, in \c{bin} \IR{segment alignment, in obj} segment alignment, in \c{obj} @@ -336,7 +339,7 @@ distribution archive, for the license conditions under which you may use NASM. NASM is now under the so-called 2-clause BSD license, also known as the simplified BSD license. -Copyright 1996-2011 the NASM Authors - All rights reserved. +Copyright 1996-2016 the NASM Authors - All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are @@ -4395,6 +4398,9 @@ output format defaults to 16-bit mode in anticipation of it being used most frequently to write DOS \c{.COM} programs, DOS \c{.SYS} device drivers and boot loader software. +The \c{BITS} directive can also be used to generate code for a +different mode than the standard one for the output format. + You do \e{not} need to specify \c{BITS 32} merely in order to use 32-bit instructions in a 16-bit DOS program; if you do, the assembler will generate incorrect code because it will be writing @@ -5428,6 +5434,14 @@ data for "safe exception handler table" causes no backward incompatibilities and "safeseh" modules generated by NASM 2.03 and later can still be linked by earlier versions or non-Microsoft linkers. +\S{codeview} Debugging formats for Windows +\I{Windows debugging formats} + +The \c{win32} and \c{win64} formats support the Microsoft CodeView +debugging format. Currently CodeView version 8 format is supported +(\i\c{cv8}), but newer versions of the CodeView debugger should be +able to handle this format as well. + \H{win64fmt} \i\c{win64}: Microsoft Win64 Object Files @@ -5695,12 +5709,58 @@ the \c{info} section type are not supported. \H{machofmt} \I{Mach-O}\i\c{macho32} and \i\c{macho64}: \i{Mach Object File Format} -The \c{macho32} and \c{macho64} output formts produces \c{Mach-O} +The \c{macho32} and \c{macho64} output formts produces Mach-O object files suitable for linking with the \i{MacOS X} linker. \i\c{macho} is a synonym for \c{macho32}. \c{macho} provides a default output file-name extension of \c{.o}. +\S{machosect} \c{macho} extensions to the \c{SECTION} Directive +\I{SECTION, macho extensions to} + +The \c{macho} output format specifies section names in the format +"\e{segment}\c{,}\e{section}". No spaces are allowed around the +comma. The following flags can also be specified: + +\b \c{data} - this section contains initialized data items + +\b \c{text} - this section contains code exclusively + +\b \c{mixed} - this section contains both code and data + +\b \c{bss} - this section is uninitialized and filled with zero + +\b \c{align=}\e{alignment} - specify section alignment + +The default is \c{data}, unless the section name is \c{__text} or +\c{__bss} in which case the default is \c{text} or \c{bss}, +respectively. + +For compatibility with other Unix platforms, the following standard +names are also supported: + +\c .text = __TEXT,__text text +\c .rodata = __DATA,__const data +\c .data = __DATA,__data data +\c .bss = __DATA,__bss bss + +If the \c{.rodata} section contains no relocations, it is instead put +into the \c{__TEXT,__const} section unless this section has already +been specified explicitly. However, it is probably better to specify +\c{__TEXT,__const} and \c{__DATA,__const} explicitly as appropriate. + +\S{machotls} \i{Thread Local Storage in Mach-O}\I{TLS}: \c{macho} special +symbols and \i\c{WRT} + +Mach-O defines the following special symbols that can be used on the +right-hand side of the \c{WRT} operator: + +\b \c{..tlvp} is used to specify access to thread-local storage. + +\b \c{..gotpcrel} is used to specify references to the Global Offset + Table. The GOT is supported in the \c{macho64} format only. + + \H{elffmt} \i\c{elf32}, \i\c{elf64}, \i\c{elfx32}: \I{ELF}\I{linux, elf}\i{Executable and Linkable Format} Object Files @@ -5715,13 +5775,14 @@ ABI with the CPU in 64-bit mode. \S{abisect} ELF specific directive \i\c{osabi} -The ELF header specifies the application binary interface for the target operating system (OSABI). -This field can be set by using the \c{osabi} directive with the numeric value (0-255) of the target - system. If this directive is not used, the default value will be "UNIX System V ABI" (0) which will work on - most systems which support ELF. +The ELF header specifies the application binary interface for the +target operating system (OSABI). This field can be set by using the +\c{osabi} directive with the numeric value (0-255) of the target +system. If this directive is not used, the default value will be "UNIX +System V ABI" (0) which will work on most systems which support ELF. -\S{elfsect} \c{elf} Extensions to the \c{SECTION} -Directive\I{SECTION, elf extensions to} +\S{elfsect} \c{elf} extensions to the \c{SECTION} Directive +\I{SECTION, elf extensions to} Like the \c{obj} format, \c{elf} allows you to specify additional information on the \c{SECTION} directive line, to control the type @@ -5779,15 +5840,9 @@ qualifiers are: Please note that section names are case sensitive.) -\S{elfwrt} \i{Position-Independent Code}\I{PIC}: \c{elf} Special +\S{elfwrt} \i{Position-Independent Code}\I{PIC}: \c{macho} Special Symbols and \i\c{WRT} -The \c{ELF} specification contains enough features to allow -position-independent code (PIC) to be written, which makes \i{ELF -shared libraries} very flexible. However, it also means NASM has to -be able to generate a variety of ELF specific relocation types in ELF -object files, if it is to be an assembler which can write PIC. - Since \c{ELF} does not support segment-base references, the \c{WRT} operator is not used for its normal purpose; therefore NASM's \c{elf} output format makes use of \c{WRT} for a different purpose, @@ -5836,7 +5891,7 @@ peculiarity of the dynamic linker. A fuller explanation of how to use these relocation types to write shared libraries entirely in NASM is given in \k{picdll}. -\S{elftls} \i{Thread Local Storage}\I{TLS}: \c{elf} Special +\S{elftls} \i{Thread Local Storage in ELF}\I{TLS}: \c{elf} Special Symbols and \i\c{WRT} \b In ELF32 mode, referring to an external or global symbol using |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 19:51:25
|
Commit-ID: 4afa730c03c01aac26f8a41eb5cb19622b7afa14 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=4afa730c03c01aac26f8a41eb5cb19622b7afa14 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 10:55:00 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 10:55:00 -0800 outmacho: default section flags should depend on section name only The __TEXT segment in particular contains both code and data. The most consistent thing is to look only at the section name, and have the same behavior across sections. Signed-off-by: H. Peter Anvin <hp...@li...> --- output/outmacho.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/output/outmacho.c b/output/outmacho.c index 98a440d..6179cc7 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -36,9 +36,6 @@ * NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X object files */ -/* Most of this file is, like Mach-O itself, based on a.out. For more - * guidelines see outaout.c. */ - #include "compiler.h" #include <stdio.h> @@ -710,10 +707,10 @@ static int32_t macho_section(char *name, int pass, int *bits) nasm_error(ERR_NONFATAL, "section name %s too long\n", section); } - if (!strcmp(segment, "__TEXT")) { + if (!strcmp(section, "__text")) { flags = S_REGULAR | S_ATTR_SOME_INSTRUCTIONS | S_ATTR_PURE_INSTRUCTIONS; - } else if (!strcmp(segment, "__DATA") && !strcmp(section, "__bss")) { + } else if (!strcmp(section, "__bss")) { flags = S_ZEROFILL; } else { flags = S_REGULAR; |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 19:51:25
|
Commit-ID: dea76e77793238bd35230413dfc962a1e7f03e00 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=dea76e77793238bd35230413dfc962a1e7f03e00 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 11:50:42 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 11:50:42 -0800 NASM 2.12rc5 --- version | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version b/version index 2382492..38e6cc5 100644 --- a/version +++ b/version @@ -1 +1 @@ -2.12rc4 +2.12rc5 |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 10:30:20
|
Commit-ID: 7e3b12d6daaa2f9a51115e735c8ccfcb03e5fdbc Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=7e3b12d6daaa2f9a51115e735c8ccfcb03e5fdbc Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 02:16:36 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 02:16:36 -0800 More constification, mostly of struct dfmt Make struct dfmt and the struct dfmt arrays const across the board, and make them static whereever possible. Signed-off-by: H. Peter Anvin <hp...@li...> --- nasm.h | 2 +- output/nulldbg.c | 4 ++-- output/outcoff.c | 6 +++--- output/outdbg.c | 4 ++-- output/outelf32.c | 11 ++++++----- output/outelf64.c | 11 ++++++----- output/outelfx32.c | 11 ++++++----- output/outform.c | 16 ++++++++++------ output/outform.h | 6 +++--- output/outieee.c | 4 ++-- output/outlib.h | 2 +- output/outobj.c | 4 ++-- 12 files changed, 44 insertions(+), 37 deletions(-) diff --git a/nasm.h b/nasm.h index 140539e..71eb148 100644 --- a/nasm.h +++ b/nasm.h @@ -683,7 +683,7 @@ struct ofmt { /* * this is a pointer to the first element of the debug information */ - struct dfmt **debug_formats; + const struct dfmt * const *debug_formats; /* * the default debugging format if -F is not specified diff --git a/output/nulldbg.c b/output/nulldbg.c index 581a1c5..e8f87d7 100644 --- a/output/nulldbg.c +++ b/output/nulldbg.c @@ -77,7 +77,7 @@ void null_debug_cleanup(void) { } -struct dfmt null_debug_form = { +const struct dfmt null_debug_form = { "Null debug format", "null", null_debug_init, @@ -89,4 +89,4 @@ struct dfmt null_debug_form = { null_debug_cleanup }; -struct dfmt *null_debug_arr[2] = { &null_debug_form, NULL }; +const struct dfmt * const null_debug_arr[2] = { &null_debug_form, NULL }; diff --git a/output/outcoff.c b/output/outcoff.c index e208c93..3daccb7 100644 --- a/output/outcoff.c +++ b/output/outcoff.c @@ -1190,11 +1190,11 @@ const struct ofmt of_coff = { #endif -extern struct dfmt df_cv8; +extern const struct dfmt df_cv8; #ifdef OF_WIN32 -struct dfmt *win32_debug_arr[2] = { &df_cv8, NULL }; +static const struct dfmt * const win32_debug_arr[2] = { &df_cv8, NULL }; const struct ofmt of_win32 = { "Microsoft Win32 (i386) object files", @@ -1220,7 +1220,7 @@ const struct ofmt of_win32 = { #ifdef OF_WIN64 -struct dfmt *win64_debug_arr[2] = { &df_cv8, NULL }; +static const struct dfmt * const win64_debug_arr[2] = { &df_cv8, NULL }; const struct ofmt of_win64 = { "Microsoft Win64 (x86-64) object files", diff --git a/output/outdbg.c b/output/outdbg.c index b954f14..fdd8032 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -242,7 +242,7 @@ static void dbgdbg_typevalue(int32_t type) fprintf(ofile, "new type: %s(%"PRIX32")\n", types[TYM_TYPE(type) >> 3], TYM_ELEMENTS(type)); } -static struct dfmt debug_debug_form = { +static const struct dfmt debug_debug_form = { "Trace of all info passed to debug stage", "debug", dbgdbg_init, @@ -254,7 +254,7 @@ static struct dfmt debug_debug_form = { dbgdbg_cleanup, }; -static struct dfmt *debug_debug_arr[3] = { +static const struct dfmt * const debug_debug_arr[3] = { &debug_debug_form, &null_debug_form, NULL diff --git a/output/outelf32.c b/output/outelf32.c index bc8be22..24efc0f 100644 --- a/output/outelf32.c +++ b/output/outelf32.c @@ -152,8 +152,8 @@ static int arangeslen, arangesrellen, pubnameslen, infolen, inforellen, abbrevlen, linelen, linerellen, framelen, loclen; static int32_t dwarf_infosym, dwarf_abbrevsym, dwarf_linesym; -static struct dfmt df_dwarf; -static struct dfmt df_stabs; +static const struct dfmt df_dwarf; +static const struct dfmt df_stabs; static struct elf_symbol *lastsym; /* common debugging routines */ @@ -1335,7 +1335,7 @@ static int elf_set_info(enum geninfo type, char **val) (void)val; return 0; } -static struct dfmt df_dwarf = { +static const struct dfmt df_dwarf = { "ELF32 (i386) dwarf debug format for Linux/Unix", "dwarf", dwarf_init, @@ -1346,7 +1346,7 @@ static struct dfmt df_dwarf = { dwarf_output, dwarf_cleanup }; -static struct dfmt df_stabs = { +static const struct dfmt df_stabs = { "ELF32 (i386) stabs debug format for Linux/Unix", "stabs", null_debug_init, @@ -1358,7 +1358,8 @@ static struct dfmt df_stabs = { stabs_cleanup }; -struct dfmt *elf32_debugs_arr[3] = { &df_dwarf, &df_stabs, NULL }; +static const struct dfmt * const elf32_debugs_arr[3] = + { &df_dwarf, &df_stabs, NULL }; const struct ofmt of_elf32 = { "ELF32 (i386) object files (e.g. Linux)", diff --git a/output/outelf64.c b/output/outelf64.c index dbd0bf0..57be311 100644 --- a/output/outelf64.c +++ b/output/outelf64.c @@ -154,8 +154,8 @@ static int arangeslen, arangesrellen, pubnameslen, infolen, inforellen, static int64_t dwarf_infosym, dwarf_abbrevsym, dwarf_linesym; -static struct dfmt df_dwarf; -static struct dfmt df_stabs; +static const struct dfmt df_dwarf; +static const struct dfmt df_stabs; static struct elf_symbol *lastsym; /* common debugging routines */ @@ -1425,7 +1425,7 @@ static int elf_set_info(enum geninfo type, char **val) (void)val; return 0; } -static struct dfmt df_dwarf = { +static const struct dfmt df_dwarf = { "ELF64 (x86-64) dwarf debug format for Linux/Unix", "dwarf", dwarf_init, @@ -1436,7 +1436,7 @@ static struct dfmt df_dwarf = { dwarf_output, dwarf_cleanup }; -static struct dfmt df_stabs = { +static const struct dfmt df_stabs = { "ELF64 (x86-64) stabs debug format for Linux/Unix", "stabs", null_debug_init, @@ -1448,7 +1448,8 @@ static struct dfmt df_stabs = { stabs_cleanup }; -struct dfmt *elf64_debugs_arr[3] = { &df_dwarf, &df_stabs, NULL }; +static const struct dfmt * const elf64_debugs_arr[3] = + { &df_dwarf, &df_stabs, NULL }; const struct ofmt of_elf64 = { "ELF64 (x86_64) object files (e.g. Linux)", diff --git a/output/outelfx32.c b/output/outelfx32.c index 0d5edf2..5896af3 100644 --- a/output/outelfx32.c +++ b/output/outelfx32.c @@ -154,8 +154,8 @@ static int arangeslen, arangesrellen, pubnameslen, infolen, inforellen, static int32_t dwarf_infosym, dwarf_abbrevsym, dwarf_linesym; -static struct dfmt df_dwarf; -static struct dfmt df_stabs; +static const struct dfmt df_dwarf; +static const struct dfmt df_stabs; static struct elf_symbol *lastsym; /* common debugging routines */ @@ -1385,7 +1385,7 @@ static int elf_set_info(enum geninfo type, char **val) (void)val; return 0; } -static struct dfmt df_dwarf = { +static const struct dfmt df_dwarf = { "ELFX32 (x86-64) dwarf debug format for Linux/Unix", "dwarf", dwarf_init, @@ -1396,7 +1396,7 @@ static struct dfmt df_dwarf = { dwarf_output, dwarf_cleanup }; -static struct dfmt df_stabs = { +static const struct dfmt df_stabs = { "ELFX32 (x86-64) stabs debug format for Linux/Unix", "stabs", null_debug_init, @@ -1408,7 +1408,8 @@ static struct dfmt df_stabs = { stabs_cleanup }; -struct dfmt *elfx32_debugs_arr[3] = { &df_dwarf, &df_stabs, NULL }; +static const struct dfmt * const elfx32_debugs_arr[3] = + { &df_dwarf, &df_stabs, NULL }; const struct ofmt of_elfx32 = { "ELFX32 (x86_64) object files (e.g. Linux)", diff --git a/output/outform.c b/output/outform.c index 77983c0..f7c817e 100644 --- a/output/outform.c +++ b/output/outform.c @@ -47,9 +47,11 @@ #define BUILD_DRIVERS_ARRAY #include "output/outform.h" -const struct ofmt *ofmt_find(char *name, const struct ofmt_alias **ofmt_alias) +const struct ofmt *ofmt_find(const char *name, + const struct ofmt_alias **ofmt_alias) { - const struct ofmt **ofp, *of; + const struct ofmt * const *ofp; + const struct ofmt *of; unsigned int i; *ofmt_alias = NULL; @@ -72,9 +74,10 @@ const struct ofmt *ofmt_find(char *name, const struct ofmt_alias **ofmt_alias) return NULL; } -struct dfmt *dfmt_find(const struct ofmt *ofmt, char *name) +const struct dfmt *dfmt_find(const struct ofmt *ofmt, const char *name) { - struct dfmt **dfp, *df; + const struct dfmt * const *dfp; + const struct dfmt *df; for (dfp = ofmt->debug_formats; (df = *dfp); dfp++) { if (!nasm_stricmp(name, df->shortname)) @@ -85,7 +88,7 @@ struct dfmt *dfmt_find(const struct ofmt *ofmt, char *name) void ofmt_list(const struct ofmt *deffmt, FILE * fp) { - const struct ofmt **ofp, *of; + const struct ofmt * const *ofp, *of; unsigned int i; /* primary targets first */ @@ -107,7 +110,8 @@ void ofmt_list(const struct ofmt *deffmt, FILE * fp) void dfmt_list(const struct ofmt *ofmt, FILE *fp) { - struct dfmt **dfp, *df; + const struct dfmt * const *dfp; + const struct dfmt *df; for (dfp = ofmt->debug_formats; (df = *dfp); dfp++) { fprintf(fp, " %c %-10s%s\n", diff --git a/output/outform.h b/output/outform.h index f01588d..d2dfef5 100644 --- a/output/outform.h +++ b/output/outform.h @@ -288,7 +288,7 @@ extern const struct ofmt of_dbg; * drivers array based on the above defines */ -static const struct ofmt *drivers[] = { +static const struct ofmt * const drivers[] = { #ifdef OF_BIN &of_bin, &of_ith, @@ -370,8 +370,8 @@ static const struct ofmt_alias ofmt_aliases[] = { #endif /* BUILD_DRIVERS_ARRAY */ -const struct ofmt *ofmt_find(char *name, const struct ofmt_alias **ofmt_alias); -struct dfmt *dfmt_find(const struct ofmt *, char *); +const struct ofmt *ofmt_find(const char *name, const struct ofmt_alias **ofmt_alias); +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; diff --git a/output/outieee.c b/output/outieee.c index 727d04e..e290e03 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -1497,7 +1497,7 @@ static void dbgls_output(int output_type, void *param) (void)output_type; (void)param; } -static struct dfmt ladsoft_debug_form = { +static const struct dfmt ladsoft_debug_form = { "LADsoft Debug Records", "ladsoft", dbgls_init, @@ -1508,7 +1508,7 @@ static struct dfmt ladsoft_debug_form = { dbgls_output, dbgls_cleanup, }; -static struct dfmt *ladsoft_debug_arr[3] = { +static const struct dfmt *ladsoft_debug_arr[3] = { &ladsoft_debug_form, &null_debug_form, NULL diff --git a/output/outlib.h b/output/outlib.h index 1acf11d..c66dbf6 100644 --- a/output/outlib.h +++ b/output/outlib.h @@ -53,7 +53,7 @@ void null_debug_directive(const char *directive, const char *params); void null_debug_typevalue(int32_t type); void null_debug_output(int type, void *param); void null_debug_cleanup(void); -extern struct dfmt *null_debug_arr[2]; +extern const struct dfmt * const null_debug_arr[2]; #endif /* NASM_OUTLIB_H */ diff --git a/output/outobj.c b/output/outobj.c index 3cb0610..f8b35c9 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -2605,7 +2605,7 @@ static void dbgbi_output(int output_type, void *param) (void)output_type; (void)param; } -static struct dfmt borland_debug_form = { +static const struct dfmt borland_debug_form = { "Borland Debug Records", "borland", dbgbi_init, @@ -2617,7 +2617,7 @@ static struct dfmt borland_debug_form = { dbgbi_cleanup, }; -static struct dfmt *borland_debug_arr[3] = { +static const struct dfmt *borland_debug_arr[3] = { &borland_debug_form, &null_debug_form, NULL |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 10:30:19
|
Commit-ID: e746971582cf43306f3e1282af561cfaebc0d244 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=e746971582cf43306f3e1282af561cfaebc0d244 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 02:20:59 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 02:20:59 -0800 Make struct preproc_ops const Make the preproc function pointer arrays const. Signed-off-by: H. Peter Anvin <hp...@li...> --- nasm.c | 2 +- nasm.h | 4 ++-- preproc-nop.c | 2 +- preproc.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/nasm.c b/nasm.c index 01e0628..0ba96f6 100644 --- a/nasm.c +++ b/nasm.c @@ -126,7 +126,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) diff --git a/nasm.h b/nasm.h index 71eb148..517d924 100644 --- a/nasm.h +++ b/nasm.h @@ -345,8 +345,8 @@ struct preproc_ops { void (*include_path)(char *path); }; -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/preproc-nop.c b/preproc-nop.c index 8024cac..c5835ea 100644 --- a/preproc-nop.c +++ b/preproc-nop.c @@ -170,7 +170,7 @@ static void nop_include_path(char *path) (void)path; } -struct preproc_ops preproc_nop = { +const struct preproc_ops preproc_nop = { nop_reset, nop_getline, nop_cleanup, diff --git a/preproc.c b/preproc.c index d2b9bb7..fe62428 100644 --- a/preproc.c +++ b/preproc.c @@ -5237,7 +5237,7 @@ static void make_tok_num(Token * tok, int64_t val) tok->type = TOK_NUMBER; } -struct preproc_ops nasmpp = { +const struct preproc_ops nasmpp = { pp_reset, pp_getline, pp_cleanup, |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 10:30:18
|
Commit-ID: 2530a10b56a2eb9838d4f2ecf8b50f4cbb917919 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=2530a10b56a2eb9838d4f2ecf8b50f4cbb917919 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 02:28:15 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 02:28:15 -0800 Make a few more data items static and const A few more data items that should be static and const. Signed-off-by: H. Peter Anvin <hp...@li...> --- nasm.c | 2 +- output/outdbg.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/nasm.c b/nasm.c index 0ba96f6..c639812 100644 --- a/nasm.c +++ b/nasm.c @@ -617,7 +617,7 @@ enum text_options { OPT_PREFIX, OPT_POSTFIX, }; -struct textargs textopts[] = { +static const struct textargs textopts[] = { {"prefix", OPT_PREFIX}, {"postfix", OPT_POSTFIX}, {NULL, 0} diff --git a/output/outdbg.c b/output/outdbg.c index fdd8032..60a3ad2 100644 --- a/output/outdbg.c +++ b/output/outdbg.c @@ -203,7 +203,7 @@ static int dbg_set_info(enum geninfo type, char **val) return 0; } -char *types[] = { +static const char * const types[] = { "unknown", "label", "byte", "word", "dword", "float", "qword", "tbyte" }; static void dbgdbg_init(void) |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 10:30:18
|
Commit-ID: 2be1050f9340b48482b9b4846ecb86f1ba86e888 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=2be1050f9340b48482b9b4846ecb86f1ba86e888 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 02:22:50 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 02:22:50 -0800 codeview: make struct dfmt df_cv8 const This one was not declared const; fix that. Signed-off-by: H. Peter Anvin <hp...@li...> --- output/codeview.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/output/codeview.c b/output/codeview.c index 2f5bb69..f837c12 100644 --- a/output/codeview.c +++ b/output/codeview.c @@ -58,7 +58,7 @@ static void cv8_typevalue(int32_t type); static void cv8_output(int type, void *param); static void cv8_cleanup(void); -struct dfmt df_cv8 = { +const struct dfmt df_cv8 = { .fullname = "Codeview 8", .shortname = "cv8", .init = cv8_init, |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 10:30:18
|
Commit-ID: a4973cf997843e2bc2d1205a8bf0eb9092fcc91a Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a4973cf997843e2bc2d1205a8bf0eb9092fcc91a Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 02:25:26 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 02:25:26 -0800 A few more debugging format arrays to mark const Making more debugging format array const. Signed-off-by: H. Peter Anvin <hp...@li...> --- output/outieee.c | 2 +- output/outobj.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/output/outieee.c b/output/outieee.c index e290e03..0562465 100644 --- a/output/outieee.c +++ b/output/outieee.c @@ -1508,7 +1508,7 @@ static const struct dfmt ladsoft_debug_form = { dbgls_output, dbgls_cleanup, }; -static const struct dfmt *ladsoft_debug_arr[3] = { +static const struct dfmt * const ladsoft_debug_arr[3] = { &ladsoft_debug_form, &null_debug_form, NULL diff --git a/output/outobj.c b/output/outobj.c index f8b35c9..433fc2a 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -2617,7 +2617,7 @@ static const struct dfmt borland_debug_form = { dbgbi_cleanup, }; -static const struct dfmt *borland_debug_arr[3] = { +static const struct dfmt * const borland_debug_arr[3] = { &borland_debug_form, &null_debug_form, NULL |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 09:57:17
|
Commit-ID: 9e122a6603af15472d2acdcf8563fcd0fc96bb0c Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=9e122a6603af15472d2acdcf8563fcd0fc96bb0c Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 01:53:47 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 01:53:47 -0800 realpath: if we can't get the full path, return the known portion Right now, we don't check the return value from nasm_realpath(); furthermore doing so and failing is probably not the ideal behavior. If we can't get the full canonical path, then punt and just return nasm_strdup() of the known path name; better than nothing. Signed-off-by: H. Peter Anvin <hp...@li...> --- realpath.c | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/realpath.c b/realpath.c index 48b685a..d93dc15 100644 --- a/realpath.c +++ b/realpath.c @@ -57,7 +57,8 @@ */ char *nasm_realpath(const char *rel_path) { - return canonicalize_file_name(rel_path); + char *rp = canonicalize_file_name(rel_path); + return rp ? rp : nasm_strdup(rel_path); } #elif defined(HAVE_REALPATH) @@ -69,16 +70,14 @@ char *nasm_realpath(const char *rel_path) char *nasm_realpath(const char *rel_path) { - char *buf; + char *rp; - buf = realpath(rel_path, NULL); - if (buf) - return buf; + rp = realpath(rel_path, NULL); /* Not all implemetations of realpath() support a NULL second argument */ - if (errno == EINVAL) { - int path_max = -1; - char *buf; + if (!rp && errno == EINVAL) { + long path_max = -1; + char *rp; #if defined(HAVE_PATHCONF) && defined(_PC_PATH_MAX) path_max = pathconf(rel_path, _PC_PATH_MAX); /* POSIX */ @@ -94,20 +93,20 @@ char *nasm_realpath(const char *rel_path) #endif } - buf = nasm_malloc(path_max); + rp = nasm_malloc(path_max); - if (!realpath(rel_path, buf)) { - nasm_free(buf); - buf = NULL; + if (!realpath(rel_path, rp)) { + nasm_free(rp); + rp = NULL; } else { /* On some systems, pathconf() can return a very large value */ - buf[path_max - 1] = '\0'; /* Just in case overrun is possible */ - buf = nasm_realloc(buf, strlen(buf) + 1); + rp[path_max - 1] = '\0'; /* Just in case overrun is possible */ + rp = nasm_realloc(rp, strlen(rp) + 1); } } - return buf; + return rp ? rp : nasm_strdup(rel_path); } #elif defined(HAVE__FULLPATH) @@ -118,7 +117,8 @@ char *nasm_realpath(const char *rel_path) char *nasm_realpath(const char *rel_path) { - return _fullpath(NULL, rel_path, 0); + char *rp = _fullpath(NULL, rel_path, 0); + return rp ? rp : nasm_strdup(rel_path); } #else |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 09:33:18
|
Commit-ID: 501b35f234cb605ab576147ba7e20bfb986f7fd1 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=501b35f234cb605ab576147ba7e20bfb986f7fd1 Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 01:30:33 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 01:30:33 -0800 ofmt pointer in struct ofmt_alias should be const One more place where an ofmt pointer exists, and it should be const. Signed-off-by: H. Peter Anvin <hp...@li...> --- nasm.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nasm.h b/nasm.h index 808f832..140539e 100644 --- a/nasm.h +++ b/nasm.h @@ -849,7 +849,7 @@ struct ofmt { struct ofmt_alias { const char *shortname; const char *fullname; - struct ofmt *ofmt; + const struct ofmt *ofmt; }; extern const struct ofmt *ofmt; |
From: nasm-bot f. H. P. A. <hp...@li...> - 2016-02-18 09:30:17
|
Commit-ID: cd7893d02ddba6c10935a36cda6e9d41eac3ac2a Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=cd7893d02ddba6c10935a36cda6e9d41eac3ac2a Author: H. Peter Anvin <hp...@li...> AuthorDate: Thu, 18 Feb 2016 01:25:46 -0800 Committer: H. Peter Anvin <hp...@li...> CommitDate: Thu, 18 Feb 2016 01:25:46 -0800 Remove additional function pointers that never change Remove additional cached function pointers which point to static variables which are never actually changed. Just refer to the global variable instead. Signed-off-by: H. Peter Anvin <hp...@li...> --- eval.c | 22 +++++++--------------- eval.h | 7 ------- nasm.c | 4 +--- nasm.h | 1 + parser.c | 12 +++--------- parser.h | 1 - 6 files changed, 12 insertions(+), 35 deletions(-) diff --git a/eval.c b/eval.c index 1709933..f1fb05e 100644 --- a/eval.c +++ b/eval.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. * @@ -54,7 +54,6 @@ #define TEMPEXPR_DELTA 8 static scanner scan; /* Address of scanner routine */ -static lfunc labelfunc; /* Address of label routine */ static expr **tempexprs = NULL; static int ntempexprs; @@ -68,7 +67,6 @@ static struct tokenval *tokval; /* The current token */ static int i; /* The t_type of tokval */ static void *scpriv; -static struct location *location; /* Pointer to current line's segment,offset */ static int *opflags; static struct eval_hints *hint; @@ -890,11 +888,11 @@ static expr *expr6(int critical) case TOKEN_HERE: case TOKEN_BASE: /* - * If !location->known, this indicates that no + * If !location.known, this indicates that no * symbol, Here or Base references are valid because we * are in preprocess-only mode. */ - if (!location->known) { + if (!location.known) { nasm_error(ERR_NONFATAL, "%s not supported in preprocess-only mode", (i == TOKEN_HERE ? "`$'" : @@ -906,13 +904,13 @@ static expr *expr6(int critical) type = EXPR_SIMPLE; /* might get overridden by UNKNOWN */ if (i == TOKEN_BASE) { - label_seg = in_abs_seg ? abs_seg : location->segment; + label_seg = in_abs_seg ? abs_seg : location.segment; label_ofs = 0; } else if (i == TOKEN_HERE) { - label_seg = in_abs_seg ? abs_seg : location->segment; - label_ofs = in_abs_seg ? abs_offset : location->offset; + label_seg = in_abs_seg ? abs_seg : location.segment; + label_ofs = in_abs_seg ? abs_offset : location.offset; } else { - if (!labelfunc(tokval->t_charptr, &label_seg, &label_ofs)) { + if (!lookup_label(tokval->t_charptr, &label_seg, &label_ofs)) { scope = local_scope(tokval->t_charptr); if (critical == 2) { nasm_error(ERR_NONFATAL, "symbol `%s%s' undefined", @@ -951,12 +949,6 @@ static expr *expr6(int critical) } } -void eval_global_info(lfunc lookup_label, struct location * locp) -{ - labelfunc = lookup_label; - location = locp; -} - expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv, int *fwref, int critical, struct eval_hints *hints) { diff --git a/eval.h b/eval.h index 41949d4..7af17eb 100644 --- a/eval.h +++ b/eval.h @@ -39,13 +39,6 @@ #define NASM_EVAL_H /* - * Called once to tell the evaluator what output format is - * providing segment-base details, and what function can be used to - * look labels up. - */ -void eval_global_info(lfunc lookup_label, struct location * locp); - -/* * The evaluator itself. */ expr *evaluate(scanner sc, void *scprivate, struct tokenval *tv, diff --git a/nasm.c b/nasm.c index 4c9c163..01e0628 100644 --- a/nasm.c +++ b/nasm.c @@ -116,7 +116,7 @@ int64_t global_offset_changed; /* referenced in labels.c */ int64_t prev_offset_changed; int32_t stall_count; -static struct location location; +struct location location; int in_abs_seg; /* Flag we are in ABSOLUTE seg */ int32_t abs_seg; /* ABSOLUTE segment basis */ int32_t abs_offset; /* ABSOLUTE offset */ @@ -364,8 +364,6 @@ int main(int argc, char **argv) if (ofmt->stdmac) preproc->extra_stdmac(ofmt->stdmac); - parser_global_info(&location); - eval_global_info(ofmt, lookup_label, &location); /* define some macros dependent of command-line */ define_macros_late(); diff --git a/nasm.h b/nasm.h index 44b356d..808f832 100644 --- a/nasm.h +++ b/nasm.h @@ -220,6 +220,7 @@ struct location { int32_t segment; int known; }; +extern struct location location; /* * Expression-evaluator datatype. Expressions, within the diff --git a/parser.c b/parser.c index d2ad1d2..c5d6050 100644 --- a/parser.c +++ b/parser.c @@ -61,12 +61,6 @@ static int is_comma_next(void); static int i; static struct tokenval tokval; -static struct location *location; /* Pointer to current line's segment,offset */ - -void parser_global_info(struct location * locp) -{ - location = locp; -} static int prefix_slot(int prefix) { @@ -431,14 +425,14 @@ restart_parse: } if (i != TOKEN_INSN || tokval.t_integer != I_EQU) { /* - * FIXME: location->segment could be NO_SEG, in which case + * FIXME: location.segment could be NO_SEG, in which case * it is possible we should be passing 'abs_seg'. Look into this. * Work out whether that is *really* what we should be doing. * Generally fix things. I think this is right as it is, but * am still not certain. */ - ldef(result->label, in_abs_seg ? abs_seg : location->segment, - location->offset, NULL, true, false); + ldef(result->label, in_abs_seg ? abs_seg : location.segment, + location.offset, NULL, true, false); } } diff --git a/parser.h b/parser.h index 9b2b6d6..e148c7f 100644 --- a/parser.h +++ b/parser.h @@ -39,7 +39,6 @@ #ifndef NASM_PARSER_H #define NASM_PARSER_H -void parser_global_info(struct location *locp); insn *parse_line(int pass, char *buffer, insn *result, ldfunc ldef); void cleanup_insn(insn *instruction); |