Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions output/outaout.c
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,11 @@ static int32_t aout_add_gsym_reloc(struct Section *sect,
list_for_each(sym, shead)
if (sym->value == offset)
break;
if (!sym) {
nasm_nonfatal("unable to find a suitable global symbol"
" for this reference");
return 0;
}
} else {
/*
* Find the nearest symbol below this one.
Expand All @@ -506,11 +511,11 @@ static int32_t aout_add_gsym_reloc(struct Section *sect,
list_for_each(sm, shead)
if (sm->value <= offset && (!sym || sm->value > sym->value))
sym = sm;
}
if (!sym && exact) {
nasm_nonfatal("unable to find a suitable global symbol"
" for this reference");
return 0;
if (!sym) {
nasm_nonfatal("unable to find a suitable nearest symbol"
" below this reference");
return 0;
}
}

r = *sect->tail = nasm_malloc(sizeof(struct Reloc));
Expand Down Expand Up @@ -554,9 +559,11 @@ static int32_t aout_add_gotoff_reloc(struct Section *sect, int32_t segment,
asym = sdata.asym;
else if (segment == sbss.index)
asym = sbss.asym;
if (!asym)
if (!asym) {
nasm_nonfatal("`..gotoff' relocations require a non-global"
" symbol in the section");
return 0;
}

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