summaryrefslogtreecommitdiff
path: root/module/system/vm/linker.scm
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2015-12-03 22:10:31 +0100
committerAndy Wingo <wingo@pobox.com>2015-12-26 22:12:09 +0100
commit9e1c07bda6bb5ea51eb687c63a4fc53fd0de1a6a (patch)
tree3db7d38a8adbafe06fbc848f2f57a96d3c334206 /module/system/vm/linker.scm
parent3c271457f10d05b1f37c4b89c5cdcc4adec337ba (diff)
downloadguile-9e1c07bda6bb5ea51eb687c63a4fc53fd0de1a6a.tar.gz
Assembler works on byte offsets, not u32 offsets
* module/system/vm/assembler.scm (u32-ref, u32-set!, s32-ref, s32-set!): Remove these helpers. * module/system/vm/assembler.scm (<asm>): Track offsets in bytes, not u32 units. (emit, assembler, process-relocs, process-labels, link-text-object) (link-frame-maps, link-symtab, write-arities, link-docstrs) (link-procprops, link-debug): Adapt. * module/system/vm/linker.scm (process-reloc): Add addend before dividing by 4 for rel32/4 symbols.
Diffstat (limited to 'module/system/vm/linker.scm')
-rw-r--r--module/system/vm/linker.scm6
1 files changed, 2 insertions, 4 deletions
diff --git a/module/system/vm/linker.scm b/module/system/vm/linker.scm
index 8151462d5..952837737 100644
--- a/module/system/vm/linker.scm
+++ b/module/system/vm/linker.scm
@@ -394,12 +394,10 @@ symbol, as present in @var{symtab}."
(target (linker-symbol-address symbol)))
(case (linker-reloc-type reloc)
((rel32/4)
- (let ((diff (- target offset)))
+ (let ((diff (+ (- target offset) (linker-reloc-addend reloc))))
(unless (zero? (modulo diff 4))
(error "Bad offset" reloc symbol offset))
- (bytevector-s32-set! bv offset
- (+ (/ diff 4) (linker-reloc-addend reloc))
- endianness)))
+ (bytevector-s32-set! bv offset (/ diff 4) endianness)))
((rel32/1)
(let ((diff (- target offset)))
(bytevector-s32-set! bv offset