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...> - 2018-10-13 20:04:14
|
Commit-ID: 3c755dac88039b718d52ef56e8f74b5f65f3b55b Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=3c755dac88039b718d52ef56e8f74b5f65f3b55b Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 13 Oct 2018 22:57:30 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 13 Oct 2018 22:57:30 +0300 opflags: Convert is_class and is_reg_class to helpers So we can test for out of bound access and make helpers safe to use. https://bugzilla.nasm.us/show_bug.cgi?id=3392447 Reported-by: Jun <jx...@ps...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- include/opflags.h | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/include/opflags.h b/include/opflags.h index 8311dcf..28bb236 100644 --- a/include/opflags.h +++ b/include/opflags.h @@ -40,6 +40,7 @@ #include "compiler.h" #include "tables.h" /* for opflags_t and nasm_reg_flags[] */ +#include "regs.h" /* * Here we define the operand types. These are implemented as bit @@ -176,8 +177,17 @@ #define REG_CLASS_OPMASK GEN_REG_CLASS(8) #define REG_CLASS_BND GEN_REG_CLASS(9) -#define is_class(class, op) (!((opflags_t)(class) & ~(opflags_t)(op))) -#define is_reg_class(class, reg) is_class((class), nasm_reg_flags[(reg)]) +static inline bool is_class(opflags_t class, opflags_t op) +{ + return !(class & ~op); +} + +static inline bool is_reg_class(opflags_t class, opflags_t reg) +{ + if (reg >= EXPR_REG_START && reg <= EXPR_REG_END) + return is_class(class, nasm_reg_flags[reg]); + return false; +} #define IS_SREG(reg) is_reg_class(REG_SREG, (reg)) #define IS_FSGS(reg) is_reg_class(REG_FSGS, (reg)) |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-13 16:42:14
|
Commit-ID: 67f2ca2b3fb4e009ef3f7885e848b99e6a81ab29 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=67f2ca2b3fb4e009ef3f7885e848b99e6a81ab29 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 13 Oct 2018 19:41:01 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 13 Oct 2018 19:41:01 +0300 preproc: Fix out of range access in expand mmacro On specially crafetd malformed input file the params might be zapped (say due to invalid syntax) so we might access out of bound having nil dereference in best case. Note the later code in this helper uses tok_isnt_ helper which already has similar check. https://bugzilla.nasm.us/show_bug.cgi?id=3392518 Reported-by: Jordan Zebor <j....@f5...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asm/preproc.c b/asm/preproc.c index b6bed9d..0ceb243 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -3947,6 +3947,8 @@ static Token *expand_mmac_params_range(MMacro *mac, Token *tline, Token ***last) * only first token will be passed. */ tm = mac->params[(fst + mac->rotate) % mac->nparam]; + if (!tm) + goto err; head = new_Token(NULL, tm->type, tm->text, 0); tt = &head->next, tm = tm->next; while (tok_isnt_(tm, ",")) { |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-13 15:18:13
|
Commit-ID: a98a84b0d57d057ed7ec8eb401fd69407e709fca Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a98a84b0d57d057ed7ec8eb401fd69407e709fca Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 13 Oct 2018 18:15:36 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 13 Oct 2018 18:15:36 +0300 doc: Update changes Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- doc/changes.src | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/changes.src b/doc/changes.src index facc743..80415f8 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,6 +9,8 @@ since 2007. \S{cl-2.14} Version 2.14 +\b Fixed out of bound access in certain \c{EQU} parsing. + \b Fixed buffer underflow in float parsing. \b Added \c{SGX} (Intel Software Guard Extensions) instructions. |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-13 15:12:13
|
Commit-ID: a28c40d54602429c2458a95a62b1fab5142ffb9e Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a28c40d54602429c2458a95a62b1fab5142ffb9e Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 13 Oct 2018 18:10:26 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 13 Oct 2018 18:10:30 +0300 parser: Fix sigsegv on certain equ instruction parsing We should check for bounds when accessing nasm_reg_flags. Seems this bug was for long time already. https://bugzilla.nasm.us/show_bug.cgi?id=3392516 Reported-by: Jordan Zebor <j....@f5...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/parser.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/asm/parser.c b/asm/parser.c index 90e4337..297af26 100644 --- a/asm/parser.c +++ b/asm/parser.c @@ -1124,6 +1124,23 @@ is_expression: rs = 0; } + /* + * Make sure we're not out of nasm_reg_flags, still + * probably this should be fixed when we're defining + * the label. + * + * An easy trigger is + * + * e equ 0x80000000:0 + * pshufw word e-0 + * + */ + if (value->type < EXPR_REG_START || + value->type > EXPR_REG_END) { + nasm_error(ERR_NONFATAL, "invalid operand type"); + goto fail; + } + op->type &= TO; op->type |= REGISTER; op->type |= nasm_reg_flags[value->type]; |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-13 14:21:15
|
Commit-ID: 8e740c677345540985eba92462f44e4b272a7652 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=8e740c677345540985eba92462f44e4b272a7652 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 13 Oct 2018 17:18:05 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 13 Oct 2018 17:18:05 +0300 labels: Make sure nil label is never passed We already catched a case where we've missed test for non nil label and in result got sigsegv, lets rather panic next time. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/labels.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asm/labels.c b/asm/labels.c index aad473e..c00d6e5 100644 --- a/asm/labels.c +++ b/asm/labels.c @@ -219,6 +219,8 @@ static union label *find_label(const char *label, bool create, bool *created) char *label_str = NULL; struct hash_insert ip; + nasm_assert(label != NULL); + if (islocal(label)) label = label_str = nasm_strcat(prevlabel, label); |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-13 13:27:17
|
Commit-ID: e996d28c70d45008085322b442b44a9224308548 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=e996d28c70d45008085322b442b44a9224308548 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 13 Oct 2018 16:18:16 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 13 Oct 2018 16:18:16 +0300 labels: Don't nil dereference if no label provided An equ without label may cause nil dereference | equ 0x100 Fixes 98578071b9d71ecaa2344dd9c185237c1765041e Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/nasm.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index 0deec78..ae90b89 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -1481,13 +1481,11 @@ static void assemble_file(const char *fname, StrList **depend_ptr) /* forw_ref */ if (output_ins.opcode == I_EQU) { - if (!output_ins.label) - nasm_error(ERR_NONFATAL, - "EQU not preceded by label"); - - if (output_ins.operands == 1 && - (output_ins.oprs[0].type & IMMEDIATE) && - output_ins.oprs[0].wrt == NO_SEG) { + if (!output_ins.label) { + nasm_error(ERR_NONFATAL, "EQU not preceded by label"); + } else if (output_ins.operands == 1 && + (output_ins.oprs[0].type & IMMEDIATE) && + output_ins.oprs[0].wrt == NO_SEG) { define_label(output_ins.label, output_ins.oprs[0].segment, output_ins.oprs[0].offset, false); |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-10-09 07:24:26
|
Commit-ID: 0bdd7f15463529f22d2bf00a3af6514019e8417a Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=0bdd7f15463529f22d2bf00a3af6514019e8417a Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Mon, 1 Oct 2018 01:09:43 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Mon, 1 Oct 2018 01:09:43 +0300 opflags: Style unification No func change. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- include/opflags.h | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/include/opflags.h b/include/opflags.h index 469e2b9..8311dcf 100644 --- a/include/opflags.h +++ b/include/opflags.h @@ -122,10 +122,10 @@ * * Bits: 47 - 43 */ -#define REGSET_SHIFT (43) -#define REGSET_BITS (5) -#define REGSET_MASK OP_GENMASK(REGSET_BITS, REGSET_SHIFT) -#define GEN_REGSET(bit) OP_GENBIT(bit, REGSET_SHIFT) +#define REGSET_SHIFT (43) +#define REGSET_BITS (5) +#define REGSET_MASK OP_GENMASK(REGSET_BITS, REGSET_SHIFT) +#define GEN_REGSET(bit) OP_GENBIT(bit, REGSET_SHIFT) /* * Bits distribution (counted from 0) @@ -280,10 +280,10 @@ #define ZMM_L16 ( GEN_SUBCLASS(6) | ZMMREG) /* ZMM register 0 ~ 15 */ /* Register set sizes */ -#define RS2 GEN_REGSET(0) -#define RS4 GEN_REGSET(1) -#define RS8 GEN_REGSET(2) -#define RS16 GEN_REGSET(3) -#define RS32 GEN_REGSET(4) +#define RS2 GEN_REGSET(0) +#define RS4 GEN_REGSET(1) +#define RS8 GEN_REGSET(2) +#define RS16 GEN_REGSET(3) +#define RS32 GEN_REGSET(4) #endif /* NASM_OPFLAGS_H */ |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-09-29 11:33:18
|
Commit-ID: c713b5f994cf7b29164c3b6838b91f0499591434 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=c713b5f994cf7b29164c3b6838b91f0499591434 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 29 Sep 2018 14:30:14 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 29 Sep 2018 14:31:26 +0300 preproc: parse_size -- Check for string provided In case if the string is nil we will have sigsegv. https://bugzilla.nasm.us/show_bug.cgi?id=3392507 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/preproc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/asm/preproc.c b/asm/preproc.c index 8e1e636..b6bed9d 100644 --- a/asm/preproc.c +++ b/asm/preproc.c @@ -2210,8 +2210,7 @@ static int parse_size(const char *str) { { "byte", "dword", "oword", "qword", "tword", "word", "yword" }; static const int sizes[] = { 0, 1, 4, 16, 8, 10, 2, 32 }; - - return sizes[bsii(str, size_names, ARRAY_SIZE(size_names))+1]; + return str ? sizes[bsii(str, size_names, ARRAY_SIZE(size_names))+1] : 0; } /* |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-09-23 20:33:18
|
Commit-ID: 10c0f665709f99cb901786154ce39474aff32e38 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=10c0f665709f99cb901786154ce39474aff32e38 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 23 Sep 2018 23:30:44 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 23 Sep 2018 23:30:44 +0300 doc: changes -- Add a few more bullets Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- doc/changes.src | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/changes.src b/doc/changes.src index 8c2d7f1..facc743 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -9,6 +9,12 @@ since 2007. \S{cl-2.14} Version 2.14 +\b Fixed buffer underflow in float parsing. + +\b Added \c{SGX} (Intel Software Guard Extensions) instructions. + +\b Added \c{+n} syntax for multiple contiguous registers. + \b Fixed \c{subsections_via_symbols} for \c{macho} object format. \b Added the \c{--gprefix}, \c{--gpostfix}, \c{--lprefix}, and |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-09-22 11:12:14
|
Commit-ID: da3780dc224a539df5de360e24560924e2d6eca4 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=da3780dc224a539df5de360e24560924e2d6eca4 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 22 Sep 2018 14:10:36 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 22 Sep 2018 14:10:36 +0300 Fix small typo in comment Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/nasm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index acce3b8..0deec78 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -483,8 +483,8 @@ int main(int argc, char **argv) /* * If no output file name provided and this - * is not preprocess mode, we're perfectly - * fine to output into stdout + * is a preprocess mode, we're perfectly + * fine to output into stdout. */ if (!outname) { if (!(operating_mode & OP_PREPROCESS)) |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-09-22 10:48:17
|
Commit-ID: 69bb052e004fb374e2e0073d7b30ab495effaa99 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=69bb052e004fb374e2e0073d7b30ab495effaa99 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 22 Sep 2018 13:46:45 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 22 Sep 2018 13:46:45 +0300 asm: Restore showing output for preproc mode in stdout Before the commit 81b62b9f54ac8e4019a9b2ec2b95ec0faa86bd2a we've been always putting -E,-e results into stdout if no output file provded. So bring this backward compatibility back. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/nasm.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index 0c1df9f..acce3b8 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -481,9 +481,15 @@ int main(int argc, char **argv) if (ofmt->stdmac) preproc->extra_stdmac(ofmt->stdmac); - /* no output file name? */ - if (!outname) - outname = filename_set_extension(inname, ofmt->extension); + /* + * If no output file name provided and this + * is not preprocess mode, we're perfectly + * fine to output into stdout + */ + if (!outname) { + if (!(operating_mode & OP_PREPROCESS)) + outname = filename_set_extension(inname, ofmt->extension); + } /* define some macros dependent of command-line */ define_macros_late(); |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-09-15 20:09:24
|
Commit-ID: 17ffc1704b31654e3378626ca2a78cc85aed8e43 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=17ffc1704b31654e3378626ca2a78cc85aed8e43 Author: Chang S. Bae <cha...@in...> AuthorDate: Fri, 14 Sep 2018 18:51:56 +0000 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 15 Sep 2018 23:04:30 +0300 obj: Fix to initialize segment list Recent labeling mechanism changes seem to bring the case, where segment() procedure is called when the segment list is empty. Now, it will simply check and initalize the segment list. Reported-by: Ozkan Sezer <se...@gm...> Signed-off-by: Chang S. Bae <cha...@in...> --- output/outobj.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/output/outobj.c b/output/outobj.c index a223c60..beb1615 100644 --- a/output/outobj.c +++ b/output/outobj.c @@ -1392,9 +1392,10 @@ static int32_t obj_segment(char *name, int pass, int *bits) attrs++; } - obj_idx = 1; - for (seg = seghead; seg; seg = seg->next) { - obj_idx++; + for (seg = seghead, obj_idx = 1; ; seg = seg->next, obj_idx++) { + if (!seg) + break; + if (!strcmp(seg->name, name)) { if (attrs > 0 && pass == 1) nasm_error(ERR_WARNING, "segment attributes specified on" @@ -1415,7 +1416,7 @@ static int32_t obj_segment(char *name, int pass, int *bits) seg->obj_index = obj_idx; seg->grp = NULL; any_segs = true; - seg->name = NULL; + seg->name = nasm_strdup(name); seg->currentpos = 0; seg->align = 1; /* default */ seg->use32 = false; /* default */ |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-08-24 08:24:23
|
Commit-ID: 1fd4c45c96994896995c9654aa24d114777d6df5 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=1fd4c45c96994896995c9654aa24d114777d6df5 Author: Chang S. Bae <cha...@in...> AuthorDate: Thu, 23 Aug 2018 14:13:46 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 24 Aug 2018 11:21:53 +0300 doc: Fix macho section name for code While today's manual lists "text" as the code section name, "code" has been effectively named from d1da074. Reported-by: <zen...@us...> Signed-off-by: Chang S. Bae <cha...@in...> --- doc/nasmdoc.src | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index c2e80a8..fb140e9 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -5778,7 +5778,7 @@ 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{code} - this section contains code exclusively \b \c{mixed} - this section contains both code and data |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-08-24 08:24:22
|
Commit-ID: b10435f06e65df9e8fd2e1d8e8e62524e79ebec2 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b10435f06e65df9e8fd2e1d8e8e62524e79ebec2 Author: Chang S. Bae <cha...@in...> AuthorDate: Thu, 23 Aug 2018 14:13:45 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Fri, 24 Aug 2018 11:21:58 +0300 macho: Fix relocation type for relative direct branch Previously, X86_64_RELOC_BRANCH is only set for external relocations. Internal relocation also needs this type to be set, instead of the default (X86_64_RELOC_SIGNED) or anything. Reported-by: <zen...@us...> Signed-off-by: Chang S. Bae <cha...@in...> --- output/outmacho.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/output/outmacho.c b/output/outmacho.c index d092cf2..cb566f0 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -559,6 +559,8 @@ static int64_t add_reloc(struct section *sect, int32_t section, /* local */ r->ext = 0; r->snum = fi; + if (reltype == RL_BRANCH) + r->type = X86_64_RELOC_BRANCH; adjust = -sect->size; } break; |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-08-15 22:27:13
|
Commit-ID: 55d09bbf6f7087339277b1e3b17c134b2afb2510 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=55d09bbf6f7087339277b1e3b17c134b2afb2510 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Wed, 15 Aug 2018 01:12:19 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 16 Aug 2018 01:20:01 +0300 disasm: Fix buffer overread in ndisasm https://nvd.nist.gov/vuln/detail/CVE-2018-10254 https://sourceforge.net/p/nasm/bugs/561/ Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- disasm/disasm.c | 31 +++++++++++++++++++++++++++++-- disasm/disasm.h | 4 ++-- disasm/ndisasm.c | 5 ++--- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/disasm/disasm.c b/disasm/disasm.c index fa52d30..fd3eb42 100644 --- a/disasm/disasm.c +++ b/disasm/disasm.c @@ -49,6 +49,15 @@ #include "regdis.h" #include "disp8.h" +#define fetch_safe(_start, _ptr, _size, _need, _op) \ + do { \ + if (((_ptr) - (_start)) >= ((_size) - (_need))) \ + _op; \ + } while (0) + +#define fetch_or_return(_start, _ptr, _size, _need) \ + fetch_safe(_start, _ptr, _size, _need, return 0) + /* * Flags that go into the `segment' field of `insn' structures * during disassembly. @@ -1108,8 +1117,8 @@ static const char * const condition_name[16] = { "s", "ns", "pe", "po", "l", "nl", "ng", "g" }; -int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, - int64_t offset, int autosync, iflag_t *prefer) +int32_t disasm(uint8_t *data, int32_t data_size, char *output, int outbufsize, int segsize, + int64_t offset, int autosync, iflag_t *prefer) { const struct itemplate * const *p, * const *best_p; const struct disasm_index *ix; @@ -1144,41 +1153,52 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, switch (*data) { case 0xF2: case 0xF3: + fetch_or_return(origdata, data, data_size, 1); prefix.rep = *data++; break; case 0x9B: + fetch_or_return(origdata, data, data_size, 1); prefix.wait = *data++; break; case 0xF0: + fetch_or_return(origdata, data, data_size, 1); prefix.lock = *data++; break; case 0x2E: + fetch_or_return(origdata, data, data_size, 1); segover = "cs", prefix.seg = *data++; break; case 0x36: + fetch_or_return(origdata, data, data_size, 1); segover = "ss", prefix.seg = *data++; break; case 0x3E: + fetch_or_return(origdata, data, data_size, 1); segover = "ds", prefix.seg = *data++; break; case 0x26: + fetch_or_return(origdata, data, data_size, 1); segover = "es", prefix.seg = *data++; break; case 0x64: + fetch_or_return(origdata, data, data_size, 1); segover = "fs", prefix.seg = *data++; break; case 0x65: + fetch_or_return(origdata, data, data_size, 1); segover = "gs", prefix.seg = *data++; break; case 0x66: + fetch_or_return(origdata, data, data_size, 1); prefix.osize = (segsize == 16) ? 32 : 16; prefix.osp = *data++; break; case 0x67: + fetch_or_return(origdata, data, data_size, 1); prefix.asize = (segsize == 32) ? 16 : 32; prefix.asp = *data++; break; @@ -1186,6 +1206,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, case 0xC4: case 0xC5: if (segsize == 64 || (data[1] & 0xc0) == 0xc0) { + fetch_or_return(origdata, data, data_size, 2); prefix.vex[0] = *data++; prefix.vex[1] = *data++; @@ -1193,6 +1214,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, prefix.vex_c = RV_VEX; if (prefix.vex[0] == 0xc4) { + fetch_or_return(origdata, data, data_size, 1); prefix.vex[2] = *data++; prefix.rex |= (~prefix.vex[1] >> 5) & 7; /* REX_RXB */ prefix.rex |= (prefix.vex[2] >> (7-3)) & REX_W; @@ -1214,6 +1236,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, case 0x62: { if (segsize == 64 || ((data[1] & 0xc0) == 0xc0)) { + fetch_or_return(origdata, data, data_size, 4); data++; /* 62h EVEX prefix */ prefix.evex[0] = *data++; prefix.evex[1] = *data++; @@ -1237,6 +1260,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, case 0x8F: if ((data[1] & 030) != 0 && (segsize == 64 || (data[1] & 0xc0) == 0xc0)) { + fetch_or_return(origdata, data, data_size, 3); prefix.vex[0] = *data++; prefix.vex[1] = *data++; prefix.vex[2] = *data++; @@ -1272,6 +1296,7 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, case REX_P + 0xE: case REX_P + 0xF: if (segsize == 64) { + fetch_or_return(origdata, data, data_size, 1); prefix.rex = *data++; if (prefix.rex & REX_W) prefix.osize = 64; @@ -1293,8 +1318,10 @@ int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, return 0; /* No instruction table at all... */ dp = data; + fetch_or_return(origdata, dp, data_size, 1); ix += *dp++; while (ix->n == -1) { + fetch_or_return(origdata, dp, data_size, 1); ix = (const struct disasm_index *)ix->p + *dp++; } diff --git a/disasm/disasm.h b/disasm/disasm.h index 6c89293..053474d 100644 --- a/disasm/disasm.h +++ b/disasm/disasm.h @@ -42,8 +42,8 @@ #define INSN_MAX 32 /* one instruction can't be longer than this */ -int32_t disasm(uint8_t *data, char *output, int outbufsize, int segsize, - int64_t offset, int autosync, iflag_t *prefer); +int32_t disasm(uint8_t *data, int32_t data_size, char *output, int outbufsize, int segsize, + int64_t offset, int autosync, iflag_t *prefer); int32_t eatbyte(uint8_t *data, char *output, int outbufsize, int segsize); #endif diff --git a/disasm/ndisasm.c b/disasm/ndisasm.c index a4a217d..2d0cf15 100644 --- a/disasm/ndisasm.c +++ b/disasm/ndisasm.c @@ -316,9 +316,8 @@ int main(int argc, char **argv) nextsync = next_sync(offset, &synclen); } while (p > q && (p - q >= INSN_MAX || lenread == 0)) { - lendis = - disasm((uint8_t *) q, outbuf, sizeof(outbuf), bits, - offset, autosync, &prefer); + lendis = disasm((uint8_t *)q, INSN_MAX, outbuf, sizeof(outbuf), + bits, offset, autosync, &prefer); if (!lendis || lendis > (p - q) || ((nextsync || synclen) && (uint32_t)lendis > nextsync - offset)) |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-08-15 21:46:38
|
Commit-ID: a578634b61615a4a0d5e51b1d1b046efdbd9867d Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a578634b61615a4a0d5e51b1d1b046efdbd9867d Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 15 Aug 2018 23:22:21 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 16 Aug 2018 00:01:31 +0300 optimization: Introduce new flag to turn-off selectively While configuring optimization in a level is conventional, a certain optimization tends to conflict with some pragma. For example, jump match conflicts with Mach-O's "subsections-via-symbols" macro. This configurability will workaround such conflicts. Signed-off-by: Chang S. Bae <cha...@in...> --- asm/assemble.c | 6 +++--- asm/nasm.c | 21 +++++++++++---------- asm/parser.c | 4 ++-- doc/opt_var.txt | 6 ++++-- include/nasm.h | 16 +++++++++++++++- 5 files changed, 35 insertions(+), 18 deletions(-) diff --git a/asm/assemble.c b/asm/assemble.c index 5dd0d47..30dc047 100644 --- a/asm/assemble.c +++ b/asm/assemble.c @@ -528,9 +528,9 @@ static bool jmp_match(int32_t segment, int64_t offset, int bits, if (((c & ~1) != 0370) || (ins->oprs[0].type & STRICT)) return false; - if (!optimizing) + if (!optimizing.level || (optimizing.flag & OPTIM_DISABLE_JMP_MATCH)) return false; - if (optimizing < 0 && c == 0371) + if (optimizing.level < 0 && c == 0371) return false; isize = calcsize(segment, offset, bits, ins, temp); @@ -2188,7 +2188,7 @@ static enum match_result matches(const struct itemplate *itemp, /* * Is it legal? */ - if (!(optimizing > 0) && itemp_has(itemp, IF_OPT)) + if (!(optimizing.level > 0) && itemp_has(itemp, IF_OPT)) return MERR_INVALOP; /* diff --git a/asm/nasm.c b/asm/nasm.c index 55e4a8c..0c1df9f 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -117,7 +117,8 @@ const struct dfmt *dfmt; static FILE *error_file; /* Where to write error messages */ FILE *ofile = NULL; -int optimizing = MAX_OPTIMIZE; /* number of optimization passes to take */ +struct optimization optimizing = + { MAX_OPTIMIZE, OPTIM_ALL_ENABLED }; /* number of optimization passes to take */ static int cmd_sb = 16; /* by default */ iflag_t cpu; @@ -867,7 +868,7 @@ static bool process_arg(char *p, char *q, int pass) if (!*param) { /* Naked -O == -Ox */ - optimizing = MAX_OPTIMIZE; + optimizing.level = MAX_OPTIMIZE; } else { while (*param) { switch (*param) { @@ -875,12 +876,12 @@ static bool process_arg(char *p, char *q, int pass) case '5': case '6': case '7': case '8': case '9': opt = strtoul(param, ¶m, 10); - /* -O0 -> optimizing == -1, 0.98 behaviour */ - /* -O1 -> optimizing == 0, 0.98.09 behaviour */ + /* -O0 -> optimizing.level == -1, 0.98 behaviour */ + /* -O1 -> optimizing.level == 0, 0.98.09 behaviour */ if (opt < 2) - optimizing = opt - 1; + optimizing.level = opt - 1; else - optimizing = opt; + optimizing.level = opt; break; case 'v': @@ -891,7 +892,7 @@ static bool process_arg(char *p, char *q, int pass) case 'x': param++; - optimizing = MAX_OPTIMIZE; + optimizing.level = MAX_OPTIMIZE; break; default: @@ -901,8 +902,8 @@ static bool process_arg(char *p, char *q, int pass) break; } } - if (optimizing > MAX_OPTIMIZE) - optimizing = MAX_OPTIMIZE; + if (optimizing.level > MAX_OPTIMIZE) + optimizing.level = MAX_OPTIMIZE; } } break; @@ -1448,7 +1449,7 @@ static void assemble_file(const char *fname, StrList **depend_ptr) /* Not a directive, or even something that starts with [ */ parse_line(pass1, line, &output_ins); - if (optimizing > 0) { + if (optimizing.level > 0) { if (forwref != NULL && globallineno == forwref->lineno) { output_ins.forw_ref = true; do { diff --git a/asm/parser.c b/asm/parser.c index 2643099..90e4337 100644 --- a/asm/parser.c +++ b/asm/parser.c @@ -1028,7 +1028,7 @@ is_expression: op->segment = NO_SEG; /* don't care again */ op->wrt = NO_SEG; /* still don't care */ - if(optimizing >= 0 && !(op->type & STRICT)) { + if(optimizing.level >= 0 && !(op->type & STRICT)) { /* Be optimistic */ op->type |= UNITY | SBYTEWORD | SBYTEDWORD | UDWORD | SDWORD; @@ -1045,7 +1045,7 @@ is_expression: if (is_simple(value)) { if (n == 1) op->type |= UNITY; - if (optimizing >= 0 && !(op->type & STRICT)) { + if (optimizing.level >= 0 && !(op->type & STRICT)) { if ((uint32_t) (n + 128) <= 255) op->type |= SBYTEDWORD; if ((uint16_t) (n + 128) <= 255) diff --git a/doc/opt_var.txt b/doc/opt_var.txt index 4482e5d..af15c03 100644 --- a/doc/opt_var.txt +++ b/doc/opt_var.txt @@ -6,7 +6,8 @@ GLOBAL variables: - optimizing -1 flags nasm 0.98 compatible operation; + optimizing optimization meta data (with level and flag info) + .level -1 flags nasm 0.98 compatible operation; offsets usually are explicit (short/near) no optimization passes 0 flags non-optimized assembly; forward @@ -17,7 +18,8 @@ GLOBAL variables: the actual recommended minimum setting optimization passes (2 or more, plus passes 1 and 2 will be required) - + .flag 0 allow all optimizations + 1 disallow jump match optimization pass0 0 flags an optimizer pass (multiple passes) 1 flags pass1 (define labels) diff --git a/include/nasm.h b/include/nasm.h index b9f730c..020e363 100644 --- a/include/nasm.h +++ b/include/nasm.h @@ -1248,11 +1248,25 @@ enum decorator_tokens { * 2 = pass 2 */ +/* + * flag to disable optimizations selectively + * this is useful to turn-off certain optimizations + */ +enum optimization_disable_flag { + OPTIM_ALL_ENABLED = 0, + OPTIM_DISABLE_JMP_MATCH = 1 +}; + +struct optimization { + int level; + int flag; +}; + extern int pass0; extern int64_t passn; /* Actual pass number */ extern bool tasm_compatible_mode; -extern int optimizing; +extern struct optimization optimizing; extern int globalbits; /* 16, 32 or 64-bit mode */ extern int globalrel; /* default to relative addressing? */ extern int globalbnd; /* default to using bnd prefix? */ |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-08-15 21:46:33
|
Commit-ID: b8d153eb4dee2ac22fc09cfba99dbae48c724b88 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=b8d153eb4dee2ac22fc09cfba99dbae48c724b88 Author: Chang S. Bae <cha...@in...> AuthorDate: Mon, 13 Aug 2018 13:50:18 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 16 Aug 2018 00:01:38 +0300 macho: Turn off jump-match optimization for subsections_via_symbols The jump-match optimization tends to remove labels. When the "subsections_via_symbols" pragma is declared, all the labels should be emitted. Disabling the optimization (only) makes the pragma effective. It might be cleaner to extend the OFMT interface to support callback function. In this case, the reconfiguration can be done through the callback interface, rather than direct access to the global variable. Signed-off-by: Chang S. Bae <cha...@in...> --- output/outmacho.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/output/outmacho.c b/output/outmacho.c index 93b4768..d092cf2 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -1891,6 +1891,9 @@ macho_pragma(const struct pragma *pragma) if (real) head_flags |= MH_SUBSECTIONS_VIA_SYMBOLS; + /* Jmp-match optimization conflicts */ + optimizing.flag |= OPTIM_DISABLE_JMP_MATCH; + return DIRR_OK; case D_NO_DEAD_STRIP: |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-06-30 23:03:23
|
Commit-ID: a8e3d6a83681a757c4123289b517cf68acd332ee Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a8e3d6a83681a757c4123289b517cf68acd332ee Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sat, 30 Jun 2018 20:02:24 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 30 Jun 2018 20:02:24 +0300 labels: Shrink declare_label No need to pass unused 'created', find_label can handle nil here. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/labels.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/asm/labels.c b/asm/labels.c index fbc4396..ab27a61 100644 --- a/asm/labels.c +++ b/asm/labels.c @@ -417,10 +417,7 @@ static bool declare_label_lptr(union label *lptr, bool declare_label(const char *label, enum label_type type, const char *special) { - union label *lptr; - bool created; - - lptr = find_label(label, true, &created); + union label *lptr = find_label(label, true, NULL); return declare_label_lptr(lptr, type, special); } |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-06-30 23:03:23
|
Commit-ID: 70d429676bd5db1a5d437ee6f796fd4f0e122434 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=70d429676bd5db1a5d437ee6f796fd4f0e122434 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Sun, 1 Jul 2018 01:59:07 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sun, 1 Jul 2018 02:00:12 +0300 labels: Add missing backend type for extern symbols Typo in 98578071b9d71ecaa2344dd9c185237c1765041e https://bugzilla.nasm.us/show_bug.cgi?id=3392494 Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/labels.c | 1 + 1 file changed, 1 insertion(+) diff --git a/asm/labels.c b/asm/labels.c index ab27a61..aad473e 100644 --- a/asm/labels.c +++ b/asm/labels.c @@ -175,6 +175,7 @@ static void out_symdef(union label *lptr) /* Clean up this hack... */ switch(lptr->defn.type) { case LBL_GLOBAL: + case LBL_EXTERN: backend_type = 1; backend_offset = lptr->defn.offset; break; |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-06-25 21:21:16
|
Commit-ID: 1af6ef4e146b740fdc02a969c28d50e809286ee6 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=1af6ef4e146b740fdc02a969c28d50e809286ee6 Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 20 Jun 2018 17:05:12 -0700 Committer: H. Peter Anvin (Intel) <hp...@zy...> CommitDate: Mon, 25 Jun 2018 14:14:44 -0700 nasm: fix some typo and description for the option help Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin (Intel) <hp...@zy...> --- asm/nasm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index b851ac4..f9bd3db 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -1943,14 +1943,16 @@ static void help(const char xopt) " -w-foo disable warning foo (equiv. -Wno-foo)\n" " -w[+-]error[=foo]\n" " promote [specific] warnings to errors\n" - " -h show invocation summary and exit\n\n" + " -h show invocation summary and exit (also --help)\n\n" " --pragma str pre-executes a specific %%pragma\n" " --before str add line (usually a preprocessor statement) before the input\n" " --prefix str prepend the given string to all the given string\n" - " to all extern, common and global symbols\n" - " --suffix str append the given string to all the given string\n" - " to all extern, common and global symbols\n" + " to all extern, common and global symbols (also --gprefix)\n" + " --postfix str append the given string to all the given string\n" + " to all extern, common and global symbols (also --gpostfix)\n" " --lprefix str prepend the given string to all other symbols\n" + " --lpostfix str append the given string to all other symbols\n" + " --keep-all output files will not be removed even if an error happens\n" " --limit-X val set execution limit X\n"); for (i = 0; i <= LIMIT_MAX; i++) { |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-06-25 21:21:16
|
Commit-ID: ef21926ec2068d9ddd6c2e0b8de014afb2968849 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=ef21926ec2068d9ddd6c2e0b8de014afb2968849 Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 20 Jun 2018 17:05:14 -0700 Committer: H. Peter Anvin (Intel) <hp...@zy...> CommitDate: Mon, 25 Jun 2018 14:15:10 -0700 doc: 2.14 change log Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin (Intel) <hp...@zy...> --- doc/changes.src | 47 +++++++++++++++++++++++++++++++++++++++++++++++ doc/nasmdoc.src | 2 +- 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/doc/changes.src b/doc/changes.src index ddfe6b3..835cee7 100644 --- a/doc/changes.src +++ b/doc/changes.src @@ -7,6 +7,53 @@ The NASM 2 series supports x86-64, and is the production version of NASM since 2007. +\S{cl-2.14} Version 2.14 + +\b Fixed \c{subsections_via_symbols} for \c{macho} object format. + +\b Support to mangle labels based on the types through \c{%pragma}. See +\k{mangling}. + +\b Added \c{--gprefix}, \c{--gpostfix}, \c{--lprefix}, and \c{--lpostfix} +that allows commandline base symbol mangling. See \k{opt-pfix}. + +\b Supported generic \c{%pragma} namespaces, \c{output} and \c{debug}. See +\k{gen-namespace}. + +\b Added \c{--pragma} argument as \c{%pragma} option. See \k{opt-pragma}. + +\b Added \c{--before} to accept preprocess statement before input. See \k{opt-before}. + +\b Added \c{AVX512} \c{VBMI2} (Additional Bit Manipulation), \c{VNNI} (Vector +Neural Network), \c{BITALG} (Bit Algorithm), and \c{GFNI} (Galois Field New +Instruction) instructions. + +\b Support \c{STATIC} directive. See \k{static}. + +\b Support \c{private_extern} as \c{macho} specific extension to the +\c{GLOBAL} Directive. See \k{macho-pext}. + +\b Updated \c{UD0} encoding to match with the specification + +\b Added \c{--limit-X} to set execution limit. See \k{opt-limit}. + +\b Fixed \c{CPU} directive case insensitive + +\b Fixed modules name for \c{ELF}, \c{IEEE}, \c{macho}, \c{obj} output format + +\b Fixed to build \c{rdoff} tool and resolve to handle dependencies correctly +with \c{Microsoft Visual Studio} + +\b Fixed \c{Codeview} version number to be aligned with \c{NASM}’s + +\b Fixed to assign (internal) segment number correctly and efficiently + +\b Added \c{--keep-all}. See \k{opt-keep-all}. + +\b Added \c{--include} that is an alias to -P (\k{opt-p}). + +\b Added \c{--help} as an alias to -h (\k{syntax}). + \S{cl-2.13.04} Version 2.13.04 \b Added \c{-W}, \c{-D}, and \c{-Q} suffix aliases for \c{RET} diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index b6aab1c..b0db9d5 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -5851,7 +5851,7 @@ non-Mach-O builds of the same source code: \c %pragma macho no_dead_strip symbol... -\S{machosect} \c{macho} specific extensions to the \c{GLOBAL} +\S{macho-pext} \c{macho} specific extensions to the \c{GLOBAL} Directive: \i\c{private_extern} The directive extension to \c{GLOBAL} marks the symbol with limited |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-06-25 21:21:15
|
Commit-ID: 754edd85ee3e0cf668e1fd84802ab6aabeef6b8f Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=754edd85ee3e0cf668e1fd84802ab6aabeef6b8f Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 20 Jun 2018 17:05:13 -0700 Committer: H. Peter Anvin (Intel) <hp...@zy...> CommitDate: Mon, 25 Jun 2018 14:15:04 -0700 doc: document new feature from version 2.14 Added descriptions about new commandline options, STATIC directive, symbol mingling, and some output format specifics. Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: H. Peter Anvin (Intel) <hp...@zy...> --- doc/nasmdoc.src | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 139 insertions(+), 6 deletions(-) diff --git a/doc/nasmdoc.src b/doc/nasmdoc.src index 7b331d3..b6aab1c 100644 --- a/doc/nasmdoc.src +++ b/doc/nasmdoc.src @@ -368,6 +368,8 @@ To get further usage instructions from NASM, try typing \c nasm -h +\c{--help} option is also the same. + As \c{-hf}, this will also list the available output file formats, and what they are. @@ -657,10 +659,13 @@ option. So running is equivalent to running \c{nasm myfile.asm} and placing the directive \c{%include "myinc.inc"} at the start of the file. +\c{--include} option is also accepted. + For consistency with the \c{-I}, \c{-D} and \c{-U} options, this option can also be specified as \c{-P}. + \S{opt-d} The \i\c{-d}\I\c{-D} Option: \I{pre-defining macros}Pre-Define a Macro \I\c{%define}Just as the \c{-p} option gives an alternative to placing @@ -917,13 +922,72 @@ is indicated by an asterisk. For example: \c dwarf elf32 (i386) dwarf debug format for Linux -\S{opt-pfix} The \i\c{--prefix} and \i\c{--postfix} Options. +\S{opt-pfix} The \i\c{--(g|l)prefix}, \i\c{--(g|l)postfix} Options. + +The \c{--(g)prefix} options prepend the given argument +to all \c{extern}, \c{common}, \c{static}, and \c{global} symbols, and the +\c{--lprefix} option prepends to all other symbols. Similarly, +\c{--(g)postfix} and \c{--lpostfix} options append +the argument in the exactly same way as the \c{--xxprefix} options does. + +Running this: + +\c nasm -f macho --gprefix _ + +is equivalent to place the directive with \c{%pragma macho gprefix _} +at the start of the file (\k{mangling}). It will prepend the underscore +to all global and external variables, as C requires it in some, but not all, +system calling conventions. + +\S{opt-pragma} The \i\c{--pragma} Option + +NASM accepts an argument as \c{%pragma} option, which is like placing +a \c{%pragma} preprocess statement at the beginning of the source. +Running this: + +\c nasm -f macho --pragma "macho gprefix _" + +is equivalent to the example in \k{opt-pfix}. + + +\S{opt-before} The \i\c{--before} Option + +A preprocess statement can be accepted with this option. The example +shown in \k{opt-pragma} is the same as running this: + +\c nasm -f macho --before "%pragma macho gprefix _" + + +\S{opt-limit} The \i\c{--limit-X} Option + +This option allows user to setup various maximum values for these: + +\b\c{--limit-passes}: Number of maximum allowed passes. Default is +effectively unlimited. + +\b\c{--limit-stalled-passes}: Maximum number of allowed unfinished +passes. Default is 1000. + +\b\c{--limit-macro-levels}: Define maximum depth of macro expansion +(in preprocess). Default is 1000000. + +\b\c{--limit-rep}: Maximum number of allowed preprocessor loop, defined +under \c{%rep}. Default is 1000000. + +\b\c{--limit-eval}: This number sets the boundary condition of allowed +expression length. Default is 1000000. + +\b\c{--limit-lines}: Total number of source lines as allowed to be +processed. Default is 2000000000. + +In example, running this limits the maximum line count to be 1000. + +\c nasm --limit-lines 1000 -The \c{--prefix} and \c{--postfix} options prepend or append -(respectively) the given argument to all \c{global} or -\c{extern} variables. E.g. \c{--prefix _} will prepend the -underscore to all global and external variables, as C requires it in -some, but not all, system calling conventions. + +\S{opt-keep-all} The \i\c{--keep-all} Option + +This option doesn't delete any output files even if an error happens. \S{nasmenv} The \i\c{NASMENV} \i{Environment} Variable @@ -4607,6 +4671,62 @@ Once again, like \c{EXTERN} and \c{GLOBAL}, the primitive form of \c{COMMON} differs from the user-level form only in that it can take only one argument at a time. +\H{static} \i\c{STATIC}: Local Symbols within Modules + +Opposite to \c{EXTERN} and \c{GLOBAL}, \c{STATIC} is local symbol, +but should be named according to the global mangling rules (named +by analogy with the C keyword "static" as applied to the functions). +And like \c{GLOBAL} directive, the directive applying to a symbol +should be \i{before} the definition of the symbol. For example: + +\c static foo +\c foo: +\c ; codes + +Unlike \c{GLOBAL}, \c{STATIC} does not allow object formats to accept +private extensions mentioned in \k{global}. + +\H{mangling} \i\c{(G|L)PREFIX}, \i\c{(G|L)POSTFIX}: Mangling Symbols + +\c{PREFIX}, \c{GPREFIX}, \c{LPREFIX}, \c{POSTFIX}, \c{GPOSTFIX}, and +\c{LPOSTFIX} directives can prepend or append the given argument to +a certain type of symbols. The directive should be as a preprocess +statement. Each usage is: + +\b\c{PREFIX}|\c{GPREFIX}: Prepend the argument to all \c{EXTERN} +\c{COMMON}, \c{STATIC}, and \c{GLOBAL} symbols + +\b\c{LPREFIX}: Prepend the argument to all other symbols +such as Local Labels, and backend defined symbols + +\b\c{POSTFIX}|\c{GPOSTFIX}: Append the argument to all \c{EXTERN} +\c{COMMON}, \c{STATIC}, and \c{GLOBAL} symbols + +\b\c{LPOSTFIX}: Append the argument to all other symbols +such as Local Labels, and backend defined symbols + +This is a macro implemented as a \c{%pragma}: + +\c %pragma macho lprefix L_ + +Commandline option is also possible. See also \k{opt-pfix}. + + +\H{gen-namespace} \i\c{OUTPUT}, \i\c{DEBUG}: Generic Namespaces + +\c{OUTPUT} and \c{DEBUG} are generic \c{%pragma} namespaces that are +supposed to redirect to the current output and debug formats. +For example, when mangling local symbols via the generic namespace: + +\c %pragma output gprefix _ + +This is useful when the directive is needed to be output format +agnostic. + +The example is also euquivalent to this, when the output format is \c{elf}: + +\c %pragma elf gprefix _ + \H{CPU} \i\c{CPU}: Defining CPU Dependencies @@ -5731,6 +5851,19 @@ non-Mach-O builds of the same source code: \c %pragma macho no_dead_strip symbol... +\S{machosect} \c{macho} specific extensions to the \c{GLOBAL} +Directive: \i\c{private_extern} + +The directive extension to \c{GLOBAL} marks the symbol with limited +global scope. For example, you can specify the global symbol with +this extension: + +\c global foo:private_extern +\c foo: +\c ; codes + +Using with static linker will clear the private extern attribute. +But linker option like \c{-keep_private_externs} can avoid it. \H{elffmt} \i\c{elf32}, \i\c{elf64}, \i\c{elfx32}: \I{ELF}\I{linux, elf}\i{Executable and Linkable Format} Object Files |
From: nasm-bot f. C. G. <gor...@gm...> - 2018-06-06 21:15:22
|
Commit-ID: a7f318c307369f23d879c35984cf931befa89843 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=a7f318c307369f23d879c35984cf931befa89843 Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Thu, 7 Jun 2018 00:06:58 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Thu, 7 Jun 2018 00:06:58 +0300 directive: Make cpu directive case insensitive back again During code suffle we occasionally made cpu directive to take letter case into account despite the documentation. https://bugzilla.nasm.us/show_bug.cgi?id=3392491 Reported-by: Rebecca Cran <re...@bl...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/directiv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/asm/directiv.c b/asm/directiv.c index fa800b9..567a6bd 100644 --- a/asm/directiv.c +++ b/asm/directiv.c @@ -102,7 +102,7 @@ static iflag_t get_cpu(const char *value) iflag_clear_all(&r); for (cpu = cpunames; cpu->name; cpu++) { - if (!strcmp(value, cpu->name)) + if (!nasm_stricmp(value, cpu->name)) break; } |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-05-05 20:48:25
|
Commit-ID: f0ceb1e122dc3523123dd8dfd6113f2e68451452 Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=f0ceb1e122dc3523123dd8dfd6113f2e68451452 Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 2 May 2018 08:07:53 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 5 May 2018 23:44:33 +0300 assemble: Check global line limit Without the limit, the while loop opens to semi-infinite that will exhaustively consume the heap space. Also, the index value gets into the garbage. https://bugzilla.nasm.us/show_bug.cgi?id=3392474 Reported-by : Dongliang Mu <mud...@gm...> Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/nasm.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/asm/nasm.c b/asm/nasm.c index 666c337..ecab73b 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -105,6 +105,8 @@ static const char *listname; static const char *errname; static int globallineno; /* for forward-reference tracking */ +#define GLOBALLINENO_MAX INT32_MAX + /* static int pass = 0; */ const struct ofmt *ofmt = &OF_DEFAULT; const struct ofmt_alias *ofmt_alias = NULL; @@ -1342,7 +1344,10 @@ static void assemble_file(const char *fname, StrList **depend_ptr) location.offset = offs = get_curr_offs(); while ((line = preproc->getline())) { - globallineno++; + if (globallineno++ == GLOBALLINENO_MAX) + nasm_error(ERR_FATAL, + "overall line number reaches the maximum %d\n", + GLOBALLINENO_MAX); /* * Here we parse our directives; this is not handled by the |
From: nasm-bot f. C. S. B. <cha...@in...> - 2018-05-05 20:48:24
|
Commit-ID: 427d8e3e57b68370daa143c3e501df9c23e9869f Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=427d8e3e57b68370daa143c3e501df9c23e9869f Author: Chang S. Bae <cha...@in...> AuthorDate: Wed, 2 May 2018 08:07:52 -0700 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Sat, 5 May 2018 23:44:33 +0300 output: macho -- Avoid conversion of addresses to RAWDATA Without relocation, the linker may do erroneous dead strip. For the relocation, the conversion of addresses to RAWDATA should be avoided for Mach-O. https://bugzilla.nasm.us/show_bug.cgi?id=3392469 Reported-by: Andrew Fish <af...@ap...> Signed-off-by: Chang S. Bae <cha...@in...> Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/assemble.c | 3 ++- include/nasm.h | 4 +++- output/outmacho.c | 18 ++++++++++-------- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/asm/assemble.c b/asm/assemble.c index 561bba5..a6bb0ee 100644 --- a/asm/assemble.c +++ b/asm/assemble.c @@ -366,7 +366,8 @@ static void out(struct out_data *data) nasm_assert(data->size <= 8); asize = data->size; amax = ofmt->maxbits >> 3; /* Maximum address size in bytes */ - if (data->tsegment == fixseg && data->twrt == NO_SEG) { + if ((ofmt->flags & OFMT_KEEP_ADDR) == 0 && data->tsegment == fixseg && + data->twrt == NO_SEG) { warn_overflow_out(addrval, asize, data->sign); xdata.q = cpu_to_le64(addrval); data->data = xdata.b; diff --git a/include/nasm.h b/include/nasm.h index 48590f2..a5a7b66 100644 --- a/include/nasm.h +++ b/include/nasm.h @@ -786,7 +786,9 @@ struct ofmt { /* * Output format flags. */ -#define OFMT_TEXT 1 /* Text file format */ +#define OFMT_TEXT 1 /* Text file format */ +#define OFMT_KEEP_ADDR 2 /* Keep addr; no conversion to data */ + unsigned int flags; int maxbits; /* Maximum segment bits supported */ diff --git a/output/outmacho.c b/output/outmacho.c index a92b9ec..3eeb057 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -690,8 +690,8 @@ static void macho_output(int32_t secto, const void *data, break; } + case OUT_REL1ADR: case OUT_REL2ADR: - nasm_assert(section != secto); p = mydata; offset = *(int64_t *)data; @@ -708,15 +708,16 @@ static void macho_output(int32_t secto, const void *data, " this use of WRT"); wrt = NO_SEG; /* we can at least _try_ to continue */ } else { - addr += add_reloc(s, section, addr+size, RL_REL, 2); + addr += add_reloc(s, section, addr+size, RL_REL, + type == OUT_REL1ADR ? 1 : 2); } WRITESHORT(p, addr); - sect_write(s, mydata, 2); + sect_write(s, mydata, type == OUT_REL1ADR ? 1 : 2); break; case OUT_REL4ADR: - nasm_assert(section != secto); + case OUT_REL8ADR: p = mydata; offset = *(int64_t *)data; @@ -770,9 +771,10 @@ static void macho_output(int32_t secto, const void *data, /* continue with RL_REL */ } - addr += add_reloc(s, section, offset, reltype, 4); + addr += add_reloc(s, section, offset, reltype, + type == OUT_REL4ADR ? 4 : 8); WRITELONG(p, addr); - sect_write(s, mydata, 4); + sect_write(s, mydata, type == OUT_REL4ADR ? 4 : 8); break; default: @@ -2321,7 +2323,7 @@ const struct ofmt of_macho32 = { "NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (i386) object files", "macho32", ".o", - 0, + OFMT_KEEP_ADDR, 32, macho32_df_arr, &macho32_df_dwarf, @@ -2386,7 +2388,7 @@ const struct ofmt of_macho64 = { "NeXTstep/OpenStep/Rhapsody/Darwin/MacOS X (x86_64) object files", "macho64", ".o", - 0, + OFMT_KEEP_ADDR, 64, macho64_df_arr, &macho64_df_dwarf, |