From 957afd15a747eced1c5ee870d38316f7f97230d8 Mon Sep 17 00:00:00 2001 From: TheCPP Date: Tue, 27 Aug 2024 17:44:57 +0200 Subject: [PATCH] [FIX] fixing a bit of instuction encoding --- src/Obj/wrapper.rs | 3 +-- src/Target/x64/asm/instr.rs | 6 +++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Obj/wrapper.rs b/src/Obj/wrapper.rs index b29dddbf..2401da31 100644 --- a/src/Obj/wrapper.rs +++ b/src/Obj/wrapper.rs @@ -263,8 +263,7 @@ impl ObjectBuilder { if self.triple.getCallConv() == Ok(CallConv::WindowsFastCall) { addend = match ty { Decl::Function => 0, - Decl::Data => -1, - Decl::Constant => -1, + _ => -1, }; offset = -4; } else if self.triple.getCallConv() == Ok(CallConv::SystemV) { diff --git a/src/Target/x64/asm/instr.rs b/src/Target/x64/asm/instr.rs index 4e0beeb3..e3f582e5 100644 --- a/src/Target/x64/asm/instr.rs +++ b/src/Target/x64/asm/instr.rs @@ -124,10 +124,10 @@ impl Instr { } op.push(m); - if !mem.rex(true).empty() { + if !mem.rex(false).empty() { if let Some(rext) = rex { - rex = Some(rext.sync(mem.rex(true))); - } else {rex = Some(mem.rex(true))} + rex = Some(rext.sync(mem.rex(false))); + } else {rex = Some(mem.rex(false))} } let enc = &mem.encode(Some(op0.boxed()));