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
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.
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.
Joined: 16 Jun 2003
Location: Kraków, Poland
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.
It was even worse than that. Windows 9x accepted empty sections, but frowned on empty fixups, while NT-based Windows had no problem with empty fixups but did not allow empty sections. There was no consistent Win32 behavior for these cases.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum