[fpc-devel] internal linker import by index patch (xbox)
Yury Sidorov
jura at cp-lab.com
Thu Sep 20 08:25:43 CEST 2007
From: "Andrew Haines" <AndrewD207 at aol.com>
> Hi,
>
> This patch is not ready yet, but can anyone give comments on the
> correctness of the third hunk in the patch dealing with AOrdNr?
>
> I've been working on getting fpc able to make xbox(1) programs and
> on
> the xbox there are no libraries but only kernel imports which are
> imported by number.
>
> A short explanation:
>
> An xbox exe is very similar to a win32 exe. It only links to the
> xbox
> kernel and imports functions by index. If an exe is generated that
> doesn't link to the standard win32 libs like kernel32.dll, then the
> program can be converted to an xbe(xbox executable) using a program
> called cxbe.
>
> So... with the third hunk applied and a bare system unit and a bunch
> of
> small changes here and there, I've been able to make a xbox program
> with
> fpc that I converted with cxbe. (all it does is write to video
> memory
> and then reboot)
>
> Is the patch correct? I suspect that importing by ordinal is not
> currently working for regular exe's made with the internal linker.
Actually import by ordinal is implemented in works. Look at line 2416
of ogcoff.pas
When AOrdNr < 0 it indicates that import is by name, but ordinal
number is specified as hint. Whan AOrdNr > 0 then import by ordinal
only.
> The patch changes so that the Import address table is putting
> $80000000
> or'ed against the import number instead of an RVA pointing to the
> import
> number(which is incorrect since a RVA is used here only if it is an
> import by name)
>
> Sorry if none of this makes sense, I think I may have overloaded my
> brain on this one :)
Yury.
More information about the fpc-devel
mailing list