[fpc-devel] PPC64 port

Thomas Schatzl tom_at_work at gmx.at
Mon Apr 18 13:23:58 CEST 2005


   I've been working on the PPC64-port for the Linux on Power contest 
for some time now, and finally have some questions I'd like to ask for here:

Some introduction: I am trying to use the PPC64-ELF ABI for all 
generated methods, first because of compatibility issues (I believe it's 
needed anyway) and it imo does not really matter which to choose initially.
There are two problems with that though; I didn't fix them yet because 
I'm hesitating to change stuff in the compiler-directory (all ppc64 
specific things are in a subdirectory at the moment), and that's why I'm 

*) functions are not simple adresses anymore, but references to a so 
called function descriptor (if I remember the name correctly). Problem 
is that the assembly generator seems to hardcode the method 
specification prologue to:

.globl <mangledmethodname>
.type <mangledmethodname>, @function
   ... method assembly ...

Problem is that this does not seem to work on PPC64 (tried on some 
hand-made assembly code); the GNU linker assumes that 
<mangledmethodname> is a function pointer, mangles it, and the resulting 
programs always crash on calling a method... ;-)

I found that in aggas.pas this behaviour seems to be hardcoded. Is there 
another way to change the function specification prologue?
(Btw, there's a similar problem with the epilogue)

There is a way to specify "local" methods without those function 
pointers, but... this works for local methods only. :(

*) as far as I understand PPC64 ELF ABI assumes that at if there's a 
stack, the area which holds the register contents R3-R10 is always 
available (e.g. the 8x8 bytes for saving register contents). Is there a 
way to specify a minimum size for the stack without changing something 
in the method which calculates stack layout?
(I thought of something like dummy local variables if needed)

*) How do I add a symbol/constant to the TOC? I'd like to avoid certain 
really time consuming operations on constants...

*) one really minor thing: what should the platform be called? PPC64? 
POWERPC64? POWERPC_64 (like x86_64)? =)

Finally I've got some more general question on the challenge:

What does "must be optimized for 64-bit platforms" in the challenge 
details mean?
In the same sense I'd like to ask if you could specify some sort of 
minimum requirements for the port in a little more detail?
(E.g. must cycle using the makefiles, must integrate into fpc distro, 
must compile + run IDE, must successfully run x tests, etc..., whatever)


More information about the fpc-devel mailing list