flat assembler
Message board for the users of flat assembler.
Index
> Main > jmp trouble |
Author |
|
Grenader 11 Dec 2003, 18:22
fasm dont compile code like this ("invalid use of symbol"):
Code: jmp dword 0 ; or any other address why? |
|||
11 Dec 2003, 18:22 |
|
JohnFound 11 Dec 2003, 19:11
It works for me.
Maybe you should post bigger snippet from your code. Regards. |
|||
11 Dec 2003, 19:11 |
|
Grenader 11 Dec 2003, 19:33
may be, you write
Code: jmp dword [0] i'm use fasmw 1.50, and "jmp dword 0" not work. |
|||
11 Dec 2003, 19:33 |
|
Tomasz Grysztar 11 Dec 2003, 19:41
It works, but perhaps you are using PE output format, which is a relocatable format by default. In case of relocatable formats such instruction cannot be encoded correctly, so fasm generates an error. You may also find this thread helpful in that case, there is a solution for this problem based on assumption, that you won't include relocations in your PE file.
And if you are creating one of the object formats, like COFF or ELF, you cannot make such instructions at all, because those formats have to be relocatable in any case. Last edited by Tomasz Grysztar on 11 Dec 2003, 19:41; edited 1 time in total |
|||
11 Dec 2003, 19:41 |
|
JohnFound 11 Dec 2003, 19:41
Well, you can see the version, source and the result:
|
||||||||||
11 Dec 2003, 19:41 |
|
Grenader 11 Dec 2003, 20:09
Thanks!
|
|||
11 Dec 2003, 20:09 |
|
AMD64 12 Dec 2003, 10:07
Wouldn't it be better to detect if you have defined a relocation section (in PE format), and if not, generate the code correctly?
|
|||
12 Dec 2003, 10:07 |
|
AMD64 13 Dec 2003, 09:08
Ok...
Then, how about adding a nonrelocatable flag that you can use with the format directive (at least for PE format)? I'm not sure how much changes would it require, as I don't know the FAsm code that well... not too much I guess, just ignore the fixups when the flag is set. Anyway it's not a very large issue, and you can use macros to get around it, so... |
|||
13 Dec 2003, 09:08 |
|
Betov 13 Dec 2003, 09:23
Hi Priv. Are you saying that, under Win32s, PE.exe(s) require Reloc?
If yes, where did you got the info from, and (... excuse me, but i don't know of it...) is there another name for "Win32s". What OS flavour is this? Betov. |
|||
13 Dec 2003, 09:23 |
|
Tomasz Grysztar 13 Dec 2003, 09:53
Betov: No, relocations are not required for PE executable, but if the system is not able to load program at its default address, it needs relocations to execute it, and such program just won't work if it doesn't include relocations. So it is much safer to generate PE with relocations, and earlier fasm version were even generating .reloc section automatically even if it hadn't been declared in source.
And Win32s is the overlay for Windows 3.11 that allowed to run Win32 programs (those were WinNT programs only those days) on that system. Perhaps it was also a base for later kernels of Win95/98/Me series, but since Win95 it was capable of loading every program at default base 400000h, while Win32s wasn't. AMD64: Yes, that would be a solution, but since the same thing can be easily achieved with macros, I don't consider it really worth the effort. But if it happens to me that I can add such feature on the occasion of some other formatter changes, I'll do it. |
|||
13 Dec 2003, 09:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.