]> git.ipfire.org Git - thirdparty/LuaJIT.git/commitdiff
DynASM/x86: Allow [&expr] operand.
authorMike Pall <mike>
Sat, 23 Dec 2023 19:06:17 +0000 (20:06 +0100)
committerMike Pall <mike>
Sat, 23 Dec 2023 19:06:17 +0000 (20:06 +0100)
Thanks to Dmitry Stogov. #1138

dynasm/dasm_x86.lua

index 787163c0c33c83eb06324cfb479e889789a76a4d..df70fed83eeb9da9b439e8c37ca4a2ab19c770fd 100644 (file)
@@ -627,7 +627,11 @@ local function wputmrmsib(t, imark, s, vsreg, psz, sk)
        werror("NYI: rip-relative displacement followed by immediate")
       end
       -- The previous byte in the action buffer cannot be 0xe9 or 0x80-0x8f.
-      wputlabel("REL_", disp[1], 2)
+      if disp[2] == "iPJ" then
+       waction("REL_A", disp[1])
+      else
+       wputlabel("REL_", disp[1], 2)
+      end
     else
       wputdarg(disp)
     end
@@ -744,9 +748,9 @@ local function dispexpr(expr)
     return imm*map_opsizenum[ops]
   end
   local mode, iexpr = immexpr(dispt)
-  if mode == "iJ" then
+  if mode == "iJ" or mode == "iPJ" then
     if c == "-" then werror("cannot invert label reference") end
-    return { iexpr }
+    return { iexpr, mode }
   end
   return expr -- Need to return original signed expression.
 end