diff options
author | Eric Christopher <echristo@apple.com> | 2005-12-05 23:17:17 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2005-12-05 23:17:17 +0000 |
commit | 5547e191fe69992b57fc6b7d948a20bd06fd5bf3 (patch) | |
tree | 946fa9477e7137fc0443ddb20bb0b7b75b3d93b9 | |
parent | 8e5abdeeb93ac991bc72f72d9d01ac679e420969 (diff) | |
download | nasm-5547e191fe69992b57fc6b7d948a20bd06fd5bf3.tar.gz |
2005-12-05 Eric Christopher <echristo@apple.com>
* nasm/nasm/output/outmacho.c (macho_write_section): Don't add
section offset to the symbol to be relocated.
(add_reloc): Update comment.
-rw-r--r-- | output/outmacho.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/output/outmacho.c b/output/outmacho.c index caf234fa..ab5713f3 100644 --- a/output/outmacho.c +++ b/output/outmacho.c @@ -314,7 +314,7 @@ static void add_reloc(struct section *sect, long section, /* the current end of the section will be the symbol's address for ** now, might have to be fixed by macho_fixup_relocs() later on. make - ** sure, we don't make the symbol scattered by setting the highest + ** sure we don't make the symbol scattered by setting the highest ** bit by accident */ r->addr = sect->size & ~R_SCATTERED; r->ext = 0; @@ -888,11 +888,17 @@ static void macho_write_section (void) } } - /* add sizes of previous sections to current offset */ - for (s2 = sects, fi = 1; - s2 != NULL && fi < r->snum; s2 = s2->next, fi++) - if ((s2->flags & SECTION_TYPE) != S_ZEROFILL) - l += s2->size; + /* If the relocation is internal add to the current section + offset. Otherwise the only value we need is the symbol + offset which we already have. The linker takes care + of the rest of the address. */ + if (!r->ext) { + /* add sizes of previous sections to current offset */ + for (s2 = sects, fi = 1; + s2 != NULL && fi < r->snum; s2 = s2->next, fi++) + if ((s2->flags & SECTION_TYPE) != S_ZEROFILL) + l += s2->size; + } /* write new offset back */ if (r->length == 2) |