flat assembler
Message board for the users of flat assembler.
Index
> Compiler Internals > fasm 1.72: empty relocation section bug |
Author |
|
revolution 02 Jan 2018, 05:10
Actually it is a Windows bug in the loader refusing to accept empty relocs sections.
You can "fix" it by placing a dummy "dq 0" in the relocs section at the end. Or if you are worried about the extra bloat of 8 bytes you can check if the section is empty and only place the dq 0 if there is nothing else there. Last edited by revolution on 02 Jan 2018, 16:31; edited 1 time in total |
|||
02 Jan 2018, 05:10 |
|
ShabbyBumblebutt 02 Jan 2018, 05:17
I'm sure that Fasm must show a warning in that case. How i'm supposed to know why my binary not works?
|
|||
02 Jan 2018, 05:17 |
|
revolution 02 Jan 2018, 05:32
There are systems other than Windows that use the PE format. It is unfortunate that Windows has such a bug, but for most programs you can run without a relocs section perfectly fine. And for those non-trivial programs that want to have things like ASLR available then the relocs section would never be empty anyway. The impact is too low for MS to care about fixing it.
|
|||
02 Jan 2018, 05:32 |
|
ShabbyBumblebutt 02 Jan 2018, 05:46
I make some trivial stub and it not even loading - how i'm supposed to know the reason without such warning?
|
|||
02 Jan 2018, 05:46 |
|
revolution 02 Jan 2018, 06:29
I'm not sure what you are suggesting. Are you expecting fasm to tell of problems with Windows? It's actually Windows job to tell you why it fails. But Windows is not very helpful in these cases. It would be possible to make fasm always output a non-empty relocs section but then other systems that aren't Windows might fail. I don't know all the details of it, but empty sections are a problem for Windows, not just the relocs sections. It affects all sections.
|
|||
02 Jan 2018, 06:29 |
|
ShabbyBumblebutt 02 Jan 2018, 06:54
Fasm can check subsystem (gui/console/native) for detecting windows program.
|
|||
02 Jan 2018, 06:54 |
|
Tomasz Grysztar 02 Jan 2018, 09:16
revolution wrote: I don't know all the details of it, but empty sections are a problem for Windows, not just the relocs sections. It affects all sections. |
|||
02 Jan 2018, 09:16 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.