1

The related code:

 23 %define data rsi
...
 33 
 34 extern g_4sha256_k
 35 
...
239 
240         movntdqa        xmm6, [data+rax*4]
241         paddd   xmm6, dword g_4sha256_k[rax*4]
242         add     rax, 4

The yasm build error:

sha256_sse4_amd64.asm:241: error: macho: sorry, cannot apply 32 bit absolute relocations in 64 bit mode, consider "[_symbol wrt rip]" for mem access, "qword" and "dq _foo" for pointers.

I know very few about these x64 asm code, could somebody help me to fix this error in paddd instruction?

gary
  • 1,569
  • 3
  • 20
  • 30
  • 1
    I'm actually surprised it allow `dword` . Would think that should be `oword` . Macho requires position independent code. You'd have to use something like `lea rxx, [g_4sha256_k wrt rip]` and then do `paddd xmm6, oword [rxx+rax*4]` where `rxx` is an available general purpose register. To avoid using `wrt rip` you can change the default from absolute to relocatable by adding `default rel` as a directive at the top of the file. Then it would be just `lea rxx, [g_4sha256_k]` – Michael Petch Dec 08 '17 at 04:01

0 Answers0