Skip to content

Commit d589aa2

Browse files
authored
Merge pull request #222 from hyc/relocs
Fix absolute address references
2 parents b27283a + 088c36f commit d589aa2

File tree

3 files changed

+17
-9
lines changed

3 files changed

+17
-9
lines changed

src/jit_compiler_a64_static.S

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,7 @@ DECL(randomx_program_aarch64_cacheline_align_mask2):
333333
add x10, x10, x1
334334

335335
DECL(randomx_program_aarch64_xor_with_dataset_line):
336+
rx_program_xor_with_dataset_line:
336337
# xor integer registers with dataset data
337338
ldp x18, x19, [x10]
338339
eor x4, x4, x18
@@ -431,14 +432,14 @@ DECL(randomx_program_aarch64_light_dataset_offset):
431432
add x2, x2, 0
432433
add x2, x2, 0
433434

434-
bl DECL(randomx_calc_dataset_item_aarch64)
435+
bl rx_calc_dataset_item
435436

436437
mov x10, sp
437438
ldp x0, x1, [sp, 64]
438439
ldp x2, x30, [sp, 80]
439440
add sp, sp, 96
440441

441-
b DECL(randomx_program_aarch64_xor_with_dataset_line)
442+
b rx_program_xor_with_dataset_line
442443

443444

444445

@@ -457,7 +458,7 @@ DECL(randomx_init_dataset_aarch64):
457458
ldr x0, [x0]
458459

459460
DECL(randomx_init_dataset_aarch64_main_loop):
460-
bl DECL(randomx_calc_dataset_item_aarch64)
461+
bl rx_calc_dataset_item
461462
add x1, x1, 64
462463
add x2, x2, 1
463464
cmp x2, x3
@@ -487,6 +488,7 @@ DECL(randomx_init_dataset_aarch64_end):
487488
# x13 -> temporary
488489

489490
DECL(randomx_calc_dataset_item_aarch64):
491+
rx_calc_dataset_item:
490492
sub sp, sp, 112
491493
stp x0, x1, [sp]
492494
stp x2, x3, [sp, 16]
@@ -533,7 +535,7 @@ DECL(randomx_calc_dataset_item_aarch64):
533535
ldr x12, superscalarAdd7
534536
eor x7, x0, x12
535537

536-
b DECL(randomx_calc_dataset_item_aarch64_prefetch)
538+
b rx_calc_dataset_item_prefetch
537539

538540
superscalarMul0: .quad 6364136223846793005
539541
superscalarAdd1: .quad 9298411001130361340
@@ -547,6 +549,7 @@ superscalarAdd7: .quad 9549104520008361294
547549
# Prefetch -> SuperScalar hash -> Mix will be repeated N times
548550

549551
DECL(randomx_calc_dataset_item_aarch64_prefetch):
552+
rx_calc_dataset_item_prefetch:
550553
# Actual mask will be inserted by JIT compiler
551554
and x11, x10, 1
552555
add x11, x8, x11, lsl 6

src/jit_compiler_x86_static.S

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,13 +91,14 @@ DECL(randomx_program_prologue):
9191
and eax, RANDOMX_SCRATCHPAD_MASK
9292
ror rdx, 32
9393
and edx, RANDOMX_SCRATCHPAD_MASK
94-
jmp DECL(randomx_program_loop_begin)
94+
jmp rx_program_loop_begin
9595

9696
.balign 64
9797
#include "asm/program_xmm_constants.inc"
9898

9999
.balign 64
100100
DECL(randomx_program_loop_begin):
101+
rx_program_loop_begin:
101102
nop
102103

103104
DECL(randomx_program_loop_load):
@@ -123,6 +124,7 @@ DECL(randomx_program_loop_end):
123124

124125
.balign 64
125126
DECL(randomx_dataset_init):
127+
rx_dataset_init:
126128
push rbx
127129
push rbp
128130
push r12
@@ -146,7 +148,7 @@ init_block_loop:
146148
prefetchw byte ptr [rsi]
147149
mov rbx, rbp
148150
.byte 232 ;# 0xE8 = call
149-
.int SUPERSCALAR_OFFSET - (call_offset - DECL(randomx_dataset_init))
151+
.int SUPERSCALAR_OFFSET - (call_offset - rx_dataset_init)
150152
call_offset:
151153
mov qword ptr [rsi+0], r8
152154
mov qword ptr [rsi+8], r9
@@ -211,13 +213,14 @@ DECL(randomx_sshash_init):
211213
xor r14, r8
212214
mov r15, qword ptr [r7_add+rip]
213215
xor r15, r8
214-
jmp DECL(randomx_program_end)
216+
jmp rx_program_end
215217

216218
.balign 64
217219
#include "asm/program_sshash_constants.inc"
218220

219221
.balign 64
220222
DECL(randomx_program_end):
223+
rx_program_end:
221224
nop
222225

223226
DECL(randomx_reciprocal_fast):

src/jit_compiler_x86_static.asm

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,15 @@ randomx_program_prologue PROC
7878
and eax, RANDOMX_SCRATCHPAD_MASK
7979
ror rdx, 32
8080
and edx, RANDOMX_SCRATCHPAD_MASK
81-
jmp randomx_program_loop_begin
81+
jmp rx_program_loop_begin
8282
randomx_program_prologue ENDP
8383

8484
ALIGN 64
8585
include asm/program_xmm_constants.inc
8686

8787
ALIGN 64
8888
randomx_program_loop_begin PROC
89+
rx_program_loop_begin::
8990
nop
9091
randomx_program_loop_begin ENDP
9192

@@ -199,14 +200,15 @@ randomx_sshash_init PROC
199200
xor r14, r8
200201
mov r15, qword ptr [r7_add]
201202
xor r15, r8
202-
jmp randomx_program_end
203+
jmp rx_program_end
203204
randomx_sshash_init ENDP
204205

205206
ALIGN 64
206207
include asm/program_sshash_constants.inc
207208

208209
ALIGN 64
209210
randomx_program_end PROC
211+
rx_program_end::
210212
nop
211213
randomx_program_end ENDP
212214

0 commit comments

Comments
 (0)