Again: please do not try to hack this in. In FPC, this assumption is completely unreliable and can break at any time for various reasons (not just the linker).
Jonas, do Seg() and Ofs() generate portability warnings from the compiler? IMO they should, and that should have been sufficient to warn OP that he was on very thin ice.
Ofs and
Seg do not require any portability warnings, cause they work correctly in flat memory (segment 0 and address in that segment encompassing the whole address space).
The problem here is not that
Ofs is not working, but that the layout of the binary is different from what the code expected in TP.
This will still not guarantee that the variables appear in the same order as in the source, even if that will usually be the case. Additionally, the OP is targeting Win32, which does not use the GNU Linker (I'm not sure we even support the GNU linker for that platform).
Yes, the GNU linker still works, I last tested it when implementing the BigObj COFF format. To enable it the
-Xe option needs to be used.