From 6ba595e7ffb9db160eb8ed8d6531c662b3f01f66 Mon Sep 17 00:00:00 2001 From: "5684185+vsariola@users.noreply.github.com" <5684185+vsariola@users.noreply.github.com> Date: Tue, 15 Oct 2024 11:57:08 +0300 Subject: [PATCH] fix(vm/compiler): produce position independent code on amd64 --- vm/compiler/x86_macros.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vm/compiler/x86_macros.go b/vm/compiler/x86_macros.go index bc19952..26d857e 100644 --- a/vm/compiler/x86_macros.go +++ b/vm/compiler/x86_macros.go @@ -402,9 +402,9 @@ func (p *X86Macros) Prepare(value string, regs ...string) (string, error) { if len(regs) > 1 { return "", fmt.Errorf("macro Prepare cannot accept more than one register parameter") } else if len(regs) > 0 { - return fmt.Sprintf("\nmov r9, qword %v\nlea r9, [r9 + %v]", value, regs[0]), nil + return fmt.Sprintf("\nlea r9, [rel %v]\nlea r9, [r9 + %v]", value, regs[0]), nil } - return fmt.Sprintf("\nmov r9, qword %v", value), nil + return fmt.Sprintf("\nlea r9, [rel %v]", value), nil } return "", nil }