xenoncat/equihash-xenon

ADDR32

Closed this issue · 3 comments

MSVC throws error when I try to link in .obj file created by FASM.

Error 1 error LNK2017: 'ADDR32' relocation to '.data' invalid without /LARGEADDRESSAWARE:NO

Has this error been fixed for linux version of your project in recent commits?

BTW; you did superb job. Is there any way to contact you privately? Or you may drop us a mail: info@nicehash.com

Hi.
The Linux object file (equihash_avx2.o) should not have ADDR32 problem. The files in Windows directory are not intended to be linked to a C project, but this may change in the future.

I have no experience with MSVC so I may have to write blindly without testing.
If you want to use MSVC, we may try to work out something. My best guess is you need MS COFF object file and Windows (rcx, rdx, r8, r9) register passing. You can request this but I don't have MSVC to test it.

FYI, there are two main differences between Linux and Windows:

  1. Object file format: Linux=ELF, Windows=COFF
  2. Register parameter passing convention: Linux=(rdi,rsi,rdx,rcx,r8,r9), Windows=(rcx,rdx,r8,r9)

Currently to build for Windows, you can use MinGW GCC. This compiler toolchain uses ELF format and you can specify to use Linux register convention by attribute((sysv_abi))
On the other hand, for MSVC, I don't know if it can read ELF, and if there is a similar trick to attribute((sysv_abi))

Actually I made it working by creating DLL in fasm, but wanted to make it create obj file, so it can be linked directly into executable.

I tried your modifications for Linux and it resolves MSVC linker issue. Also the test sol I tried to calc is correct.

You can try the "untested windows.zip" file and see if it works for MSVC. Thanks.