[fpc-devel] Building compiler, rtl, host, target... (cross compiling)

Skybuck Flying skybuck2000 at hotmail.com
Thu Apr 7 03:23:37 CEST 2011


> 4. Step 4 (building full-cross compiler)
>
> Add new target's rtl to free pascal compiler sources so that the free 
> pascal compiler can compile source into into target-(executable or 
> package/dll)-binaries.
>
> Re-build the compiler and tell it to use the new-target's-rtl as it's uses 
> clausule. (This can be via "target-free pascal binary units in combination 
> with the interface" or simply new-target's RTL full source code, since the 
> compiler should now be able to handle/compile it.

I am not so sure if the full source code of the new RTL could be used... 
probably not...

My original hunch was that it indeed needs to be in binary (pascal compiled 
units or assembly units)... and needs to be passed towards
the linker so that the linker can do "the great switchero-trick".

The compiler used it's own rtl to compile, but the linker will say "nope, 
not gonna use your rtl... instead I am gonna do a switchero trick and use 
the new rtl".

Which means the "hook-in" must be the same... so the swap goes easy...

This seems to make most sense to me... (!?)

So my guess is: It's indeed necessary to have a new RTL in binary form... so 
it can be swapped-in with the old one during the building/linking phase of a 
new compiler... (?!)


Or perhaps it doesn't matter and the compiler can simply compile with the 
new rtl full sources since it can compile those on the fly... when the reach 
the linker they already in target-binary form...

But how to know for sure and how to make the compiler not use it's own RTL ? 
This is probably my biggest/main questions... and biggest doubt how this 
works... hmm...


So this is my biggest question and hunch: At some point during this whole 
step/phase the RTL needs to be switched/swapped with the new RTL... however 
the own/old RTL is still being used by the active process (the compiler 
that's running and compiling the new compiler) so what part of the chain is 
responsible for the "switchero trick" lol ?!? Is it indeed the linker ???


Bye,
  Skybuck. 




More information about the fpc-devel mailing list