diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2015-01-11 17:19:34 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2015-01-11 17:19:34 +0300 |
commit | 78f477b35f5b646771f8be24002034b792d0a28b (patch) | |
tree | 93ad6d68f5d5a725204d5025600aad93e2aa20c2 | |
parent | 12c0702824a83d371263b6ad07c6b047b12d686d (diff) | |
download | nasm-78f477b35f5b646771f8be24002034b792d0a28b.tar.gz |
output: maco 64 -- Fix get_closest_section_symbol_by_offset
- fixup comparision it should be GE
- make sure we never return nil here
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | output/outmac64.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/output/outmac64.c b/output/outmac64.c index 44dcf0c7..fbbea063 100644 --- a/output/outmac64.c +++ b/output/outmac64.c @@ -304,12 +304,16 @@ static struct symbol *get_closest_section_symbol_by_offset(uint8_t fileindex, in for (sym = syms; sym; sym = sym->next) { if ((sym->sect != NO_SECT) && (sym->sect == fileindex)) { - if ((int64_t)sym->value > offset) + if ((int64_t)sym->value >= offset) break; nearest = sym; } } + if (!nearest) + nasm_error(ERR_FATAL, "No section for index %x offset %llx found\n", + fileindex, (long long)offset); + return nearest; } |