From a4024ab0ca1707b35e5c16822594627d15e53e53 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 1 Aug 2010 01:05:04 +0000 Subject: [PATCH] macho: Fix relocation table file location. svn path=/trunk/yasm/; revision=2344 --- modules/objfmts/macho/macho-objfmt.c | 6 +++--- modules/objfmts/macho/tests/nasm32/macho32-sect.hex | 8 ++++---- 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 -- 2.40.0