Skip to content

Commit 2016cbf

Browse files
authored
Merge branch 'master' into fix-6
2 parents 39a239c + 891c63e commit 2016cbf

File tree

20 files changed

+132
-57
lines changed

20 files changed

+132
-57
lines changed

SubmittingPatches

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Actually the rules are pretty simple
66
Obtaining the source code
77
-------------------------
88

9-
The NASM sources are tracked by Git SCM at http://repo.or.cz/w/nasm.git
9+
The NASM sources are tracked by Git SCM at https://github.com/netwide-assembler/nasm.git
1010
repository. You either could download packed sources or use git tool itself
1111

12-
git clone git://repo.or.cz/nasm.git
12+
git clone https://github.com/netwide-assembler/nasm.git
1313

1414
Changin the source code
1515
-----------------------

asm/eval.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,7 @@ static expr *eval_strfunc(enum strfunc type, const char *name)
736736
}
737737

738738
val = readstrnum(string, string_len, &rn_warn);
739+
nasm_free(string);
739740
if (parens) {
740741
scan();
741742
if (tt != ')') {

asm/listing.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
static const char xdigit[] = "0123456789ABCDEF";
2323

24-
#define HEX(a,b) (*(a)=xdigit[((b)>>4)&15],(a)[1]=xdigit[(b)&15]);
24+
#define HEX(a,b) (*(a)=xdigit[((b)>>4)&15],(a)[1]=xdigit[(b)&15])
2525

2626
uint64_t list_options, active_list_options;
2727
bool user_nolist;

asm/parser.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1202,7 +1202,8 @@ insn *parse_line(char *buffer, insn *result, const int bits)
12021202
i = tokval.t_type;
12031203
}
12041204
if (!recover && i != 0 && i != ',') {
1205-
nasm_nonfatal("comma, decorator or end of line expected, got %d", i);
1205+
nasm_nonfatal("comma, decorator or end of line expected, got `%*s'",
1206+
(int)tokval.t_len, tokval.t_start);
12061207
recover = true;
12071208
}
12081209
} else { /* immediate operand */

asm/preproc.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2813,6 +2813,9 @@ static Token **count_mmac_params(Token *tline, int *nparamp, Token ***paramsp)
28132813
}
28142814
}
28152815

2816+
if (!t)
2817+
break; /* End of string, no comma */
2818+
28162819
/* Advance to the next comma */
28172820
maybe_comma = &t->next;
28182821
while (tok_isnt(t, ',')) {

doc/changes.src

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ It is the production version of NASM since 2025.
2424
\b Fix encoding of \c{TCVTROWPS2PHL}, correct multiple AVX512-BF16
2525
instructions' operand formats and typoed mnemonics.
2626

27+
\b The unofficial but obvious alternate form \c{TEST reg,mem} was not
28+
accepted by NASM 3.00; corrected.
29+
30+
\b For the \c{obj} output format, multiple \c{GROUP} directives can
31+
now be specified for the same group; the resulting group includes
32+
all sections specified in all \c{GROUP} directives for the group.
33+
2734

2835
\S{cl-3.00} Version 3.00
2936

doc/outfmt.src

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,10 @@ A group does not have to contain any segments; you can still make
327327
you are referring to. OS/2, for example, defines the special group
328328
\c{FLAT} with no segments in it.
329329

330+
\c{GROUP} is cumulative. The above example can be done like this:
331+
332+
\c group dgroup data
333+
\c group dgroup bss
330334

331335
\S{uppercase} \i\c{UPPERCASE}: Disabling Case Sensitivity in Output
332336

doc/stdmac.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ or
4545

4646
\c db 1,32,98,0
4747

48-
Note that the above lines are generate exactly the same code, the second
48+
Note that the above lines generate exactly the same code, the second
4949
line is used just to give an indication of the order that the separate
5050
values will be present in memory.
5151

include/nasmlib.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -367,9 +367,11 @@ const char *filename_set_extension(const char *inname, const char *extension);
367367
#define list_for_each_safe(pos, _n, head) \
368368
for (pos = head, _n = (pos ? pos->next : NULL); pos; \
369369
pos = _n, _n = (_n ? _n->next : NULL))
370-
#define list_last(pos, head) \
371-
for (pos = head; pos && pos->next; pos = pos->next) \
372-
;
370+
#define list_last(pos, head) \
371+
do { \
372+
for (pos = head; pos && pos->next; pos = pos->next) \
373+
; \
374+
} while (0)
373375
#define list_reverse(head) \
374376
do { \
375377
void *_p, *_n; \

output/outaout.c

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,11 @@ static int32_t aout_add_gsym_reloc(struct Section *sect,
466466
list_for_each(sym, shead)
467467
if (sym->value == offset)
468468
break;
469+
if (!sym) {
470+
nasm_nonfatal("unable to find a suitable global symbol"
471+
" for this reference");
472+
return 0;
473+
}
469474
} else {
470475
/*
471476
* Find the nearest symbol below this one.
@@ -474,11 +479,11 @@ static int32_t aout_add_gsym_reloc(struct Section *sect,
474479
list_for_each(sm, shead)
475480
if (sm->value <= offset && (!sym || sm->value > sym->value))
476481
sym = sm;
477-
}
478-
if (!sym && exact) {
479-
nasm_nonfatal("unable to find a suitable global symbol"
480-
" for this reference");
481-
return 0;
482+
if (!sym) {
483+
nasm_nonfatal("unable to find a suitable nearest symbol"
484+
" below this reference");
485+
return 0;
486+
}
482487
}
483488

484489
r = *sect->tail = nasm_malloc(sizeof(struct Reloc));
@@ -522,9 +527,11 @@ static int32_t aout_add_gotoff_reloc(struct Section *sect, int32_t segment,
522527
asym = sdata.asym;
523528
else if (segment == sbss.index)
524529
asym = sbss.asym;
525-
if (!asym)
530+
if (!asym) {
526531
nasm_nonfatal("`..gotoff' relocations require a non-global"
527532
" symbol in the section");
533+
return 0;
534+
}
528535

529536
r = *sect->tail = nasm_malloc(sizeof(struct Reloc));
530537
sect->tail = &r->next;

0 commit comments

Comments
 (0)