From 5051c63d7ebd3874bd80a87f9b9d839a5d4074b5 Mon Sep 17 00:00:00 2001 From: Keith Kanios Date: Mon, 6 Jul 2009 21:07:15 -0500 Subject: [PATCH] outmacho: fixed section/relocation alignment issue --- output/outmacho.c | 8 ++++---- 1 file 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 */ -- 2.11.4.GIT