mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-01-24 16:35:40 +08:00
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 <sezeroz@gmail.com> Signed-off-by: Chang S. Bae <chang.seok.bae@intel.com>
This commit is contained in:
parent
b10435f06e
commit
17ffc1704b
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user