summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Kanios <keith@kanios.net>2009-07-06 21:07:15 -0500
committerKeith Kanios <keith@kanios.net>2009-07-06 21:07:15 -0500
commit5051c63d7ebd3874bd80a87f9b9d839a5d4074b5 (patch)
tree18f92dc4acecc0c67956b5c80353c48d82a8295c
parent740df430058721a51f149b26df0864d01e24ad82 (diff)
downloadnasm-5051c63d7ebd3874bd80a87f9b9d839a5d4074b5.tar.gz
outmacho: fixed section/relocation alignment issue
-rw-r--r--output/outmacho.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/output/outmacho.c b/output/outmacho.c
index 90b9958f..aeed319b 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -985,7 +985,7 @@ static void macho_write_section (void)
{
struct section *s, *s2;
struct reloc *r;
- uint8_t *p, *q, blk[4];
+ uint8_t fi, *p, *q, blk[4];
int32_t l;
for (s = sects; s != NULL; s = s->next) {
@@ -1020,9 +1020,9 @@ static void macho_write_section (void)
of the rest of the address. */
if (!r->ext) {
/* generate final address by section address and offset */
- s2 = get_section_by_index(r->snum);
- if(s2)
- l += s2->addr; // else what?!?
+ for (s2 = sects, fi = 1;
+ s2 != NULL && fi < r->snum; s2 = s2->next, fi++)
+ l += s2->size;
}
/* write new offset back */