flat assembler
Message board for the users of flat assembler.
Index
> Windows > [x64] Dll is not working |
Author |
|
yoshimitsu 21 Dec 2011, 22:25
I can't seem to get a 64bit dll working..
for example: I simply copied the code out of this thread. Windows refuses to load the dll, though, with the message that's it's not a correct image.. |
|||
21 Dec 2011, 22:25 |
|
Tomasz Grysztar 22 Dec 2011, 14:56
http://board.flatassembler.net/topic.php?p=33087#33087
Quick fix: use "data fixups" instead of separate section for relocations. Also: you forgot to align the stack at entry point ("sub rsp,8" should do the job). |
|||
22 Dec 2011, 14:56 |
|
revolution 22 Dec 2011, 15:23
See also here. Might be useful info.
|
|||
22 Dec 2011, 15:23 |
|
yoshimitsu 22 Dec 2011, 16:37
since addressing is RIP relative in x64, in which case would I even need fixups?
Is it possible to skip them entirely? I recall that a dll without a relocation entry refuses to load on x86 side question: why exactly is something like "lea rax,[ExitProcess+rax]" invalid and what's a good workaround? (lea rcx,[ExitProcess] lea rax,[rax+rcx]?) |
|||
22 Dec 2011, 16:37 |
|
Tomasz Grysztar 22 Dec 2011, 17:02
yoshimitsu wrote: why exactly is something like "lea rax,[ExitProcess+rax]" invalid and what's a good workaround? Code: mov rcx,ExitProcess ; generates 64-bit relocation add rax,rcx Code: lea rcx,[ExitProcess] ; uses RIP-relative addressing, doesn't need relocation add rax,rcx Second variant has shorter opcode and is PIC (doesn't need fixups), so it's better. However with PE format you generally should not have this problem, as it is possible to have 32-bit VA relocation there. Perhaps you are using some quite old fasm version which was not able to generate such fixup? |
|||
22 Dec 2011, 17:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.