aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Johnson <peter@tortall.net>2010-08-01 01:05:04 +0000
committerPeter Johnson <peter@tortall.net>2010-08-01 01:05:04 +0000
commita4024ab0ca1707b35e5c16822594627d15e53e53 (patch)
treedf8852b7df7ff79acd30f4f6555fe1c469f17c7b
parent86534657f27a226d03d4e0c9a36ec1a57ffa9291 (diff)
downloadyasm-a4024ab0ca1707b35e5c16822594627d15e53e53.tar.gz
macho: Fix relocation table file location.
svn path=/trunk/yasm/; revision=2344
-rw-r--r--modules/objfmts/macho/macho-objfmt.c6
-rw-r--r--modules/objfmts/macho/tests/nasm32/macho32-sect.hex8
2 files changed, 7 insertions, 7 deletions
diff --git a/modules/objfmts/macho/macho-objfmt.c b/modules/objfmts/macho/macho-objfmt.c
index e982ac5b..a3caae17 100644
--- a/modules/objfmts/macho/macho-objfmt.c
+++ b/modules/objfmts/macho/macho-objfmt.c
@@ -1188,7 +1188,7 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms,
/* next: section headers */
/* offset to relocs for first section */
- info.rel_base = align32((long)fileoffset + (long)info.filesize);
+ info.rel_base = align32((long)fileoff_sections);
info.s_reloff = 0; /* offset for relocs of following sections */
yasm_object_sections_traverse(object, &info, macho_objfmt_output_secthead);
@@ -1217,8 +1217,8 @@ macho_objfmt_output(yasm_object *object, FILE *f, int all_syms,
}
/* padding to long boundary */
- if (info.rel_base - (fileoffset + info.filesize)) {
- fwrite(pad_data, info.rel_base - (fileoffset + info.filesize), 1, f);
+ if ((info.rel_base - fileoff_sections) > 0) {
+ fwrite(pad_data, info.rel_base - fileoff_sections, 1, f);
}
/* relocation data */
diff --git a/modules/objfmts/macho/tests/nasm32/macho32-sect.hex b/modules/objfmts/macho/tests/nasm32/macho32-sect.hex
index eff781a5..aeaec6f9 100644
--- a/modules/objfmts/macho/tests/nasm32/macho32-sect.hex
+++ b/modules/objfmts/macho/tests/nasm32/macho32-sect.hex
@@ -770,16 +770,16 @@ fc
00
00
00
-fc
-02
+14
+03
00
00
00
00
00
00
-fc
-02
+14
+03
00
00
01