summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--output/outmacho.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/output/outmacho.c b/output/outmacho.c
index aeed319b..7e2f0fb3 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -1020,9 +1020,13 @@ static void macho_write_section (void)
of the rest of the address. */
if (!r->ext) {
/* generate final address by section address and offset */
- for (s2 = sects, fi = 1;
- s2 != NULL && fi < r->snum; s2 = s2->next, fi++)
- l += s2->size;
+ for (s2 = sects, fi = 1;
+ s2 != NULL; s2 = s2->next, fi++){
+ if(fi == r->snum){
+ l += s2->addr;
+ break;
+ }
+ }
}
/* write new offset back */