0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-08-23 10:33:50 -04:00

Merge 39038b2778c087f8a1619cd9e970ae88093962ed into ada267ec8cb708317e707158f0296fab5ccb794e

This commit is contained in:
Alexey Vishnyakov 2025-08-19 05:23:49 +08:00 committed by GitHub
commit 27da6842a8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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.
@ -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));
@ -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;