@@ -46,8 +46,8 @@ local action_names = {
46
46
" SETLABEL" , " REL_A" ,
47
47
-- action arg (1 byte) or int arg, 2 buffer pos (link, offset):
48
48
" REL_LG" , " REL_PC" ,
49
- -- action arg (1 byte) or int arg, 1 buffer pos (link):
50
- " IMM_LG" , " IMM_PC" , " IMM_PC64" ,
49
+ -- action arg (1 byte) or ptrdiff_t arg, 1 buffer pos (link):
50
+ " IMM_LG" , " IMM_LG64 " , " IMM_PC" , " IMM_PC64" ,
51
51
-- action arg (1 byte) or int arg, 1 buffer pos (offset):
52
52
" LABEL_LG" , " LABEL_PC" ,
53
53
-- action arg (1 byte), 1 buffer pos (offset):
@@ -434,11 +434,17 @@ local function wputlabel(aprefix, imm, num)
434
434
end
435
435
wputxb (imm )
436
436
else
437
- if aprefix == " IMM_" and x64 then
438
- waction (" IMM_PC64" , imm , num )
439
- else
440
- waction (aprefix .. " PC" , imm , num )
441
- end
437
+ waction (aprefix .. " PC" , imm , num )
438
+ end
439
+ end
440
+
441
+ -- Put action for label arg (IMM_LG64, IMM_PC64, REL_LG, REL_PC).
442
+ local function wputlabel64 (aprefix , imm , num )
443
+ if type (imm ) == " number" then
444
+ waction (" IMM_LG64" , nil , num );
445
+ wputxb (imm )
446
+ else
447
+ waction (" IMM_PC64" , imm , num )
442
448
end
443
449
end
444
450
@@ -473,6 +479,26 @@ local function wputwarg(n)
473
479
else waction (" IMM_W" , n ) end
474
480
end
475
481
482
+ -- Put signed or unsigned qword or arg.
483
+ local function wputqarg (n )
484
+ local tn = type (n )
485
+ if tn == " number" then
486
+ wputb (band (n , 255 ))
487
+ wputb (band (shr (n , 8 ), 255 ))
488
+ wputb (band (shr (n , 16 ), 255 ))
489
+ wputb (band (shr (n , 24 ), 255 ))
490
+ wputb (band (shr (n , 32 ), 255 ))
491
+ wputb (band (shr (n , 40 ), 255 ))
492
+ wputb (band (shr (n , 48 ), 255 ))
493
+ wputb (shr (n , 56 ))
494
+ elseif tn == " table" then
495
+ wputlabel64 (" IMM_" , n [1 ], 1 )
496
+ else
497
+ waction (" IMM_D" , format (" (unsigned int)(%s)" , n ))
498
+ waction (" IMM_D" , format (" (unsigned int)((%s)>>32)" , n ))
499
+ end
500
+ end
501
+
476
502
-- Put signed or unsigned dword or arg.
477
503
local function wputdarg (n )
478
504
local tn = type (n )
@@ -2069,9 +2095,17 @@ local function op_data(params)
2069
2095
werror (" bad mode or size in `" .. p .. " '" )
2070
2096
end
2071
2097
if a .mode == " iJ" then
2072
- wputlabel (" IMM_" , a .imm , 1 )
2098
+ if sz == ' q' then
2099
+ wputlabel64 (" IMM_" , a .imm , 1 )
2100
+ else
2101
+ wputlabel (" IMM_" , a .imm , 1 )
2102
+ end
2073
2103
else
2074
- wputszarg (sz , a .imm )
2104
+ if sz == ' q' then
2105
+ wputqarg (a .imm )
2106
+ else
2107
+ wputszarg (sz , a .imm )
2108
+ end
2075
2109
end
2076
2110
if secpos + 2 > maxsecpos then wflush () end
2077
2111
end
0 commit comments