[fpc-devel] How hard is it to port FPC to AIX

Peter Popov ppopov at tamu.edu
Sat Sep 13 22:49:59 CEST 2008


Thanks Jonas.
I read Felipe's wiki thouroughly and i think I can manage that part. I  
also see I have to use the Darwin (powerpc) rtl, not the linux (powerpc)  
rtl. I will start experimenting with it on monday.

I have one question though, which is not clear to me, as I am not a  
low-level system guy:
To get the whole thing started I have two options:
1. Generate cross-compiler capable of producing AIX compatible binaries  
and start working on the rtl.
2. Generate a compiler for AIX and and start working on the rtl.

Option 1 seems the easier. I don't have mac powerpc machine, so I have to  
work from linux. Your suggestion is to start with the darwin compiler,  
right? As far as I looked, AIX uses XCOFF binaries. Can the mac powerpc  
compiler generate compatible binaries? Is the FPC_DARWIN_JMP_MAIN  
suggestion solution to this problem?

Option 2 seems complicated: I will have to first generate the compiler and  
rtl object files for AIX. Next,  link the compiler on AIX using AIX's  
linker. Afterwards, work can begin on the rtl, which seems more complex?

Either way, I will have to first be able to generate aix compatible object  
files before starting the actual compiler branch. Unless you advise  
otherwise I will generate a linux-darwin cross and start experimenting  
with option 1.


Peter



On Sat, 13 Sep 2008 03:24:42 -0500, Jonas Maebe  
<jonas.maebe at elis.ugent.be> wrote:

> On 11 Sep 2008, at 20:36, Peter Popov wrote:
>
>> Peter
>>
>>> It should not be that hard. There are two main ABI's for PowerPC: the  
>>> sysv and the aix ABI. Linux/*BSD use the sysv ABI, and Mac OS, Mac OS  
>>> X and AIX uses the aix ABI. Hence, the aix abi is already supported in  
>>> the compiler. A libc-based rtl port based on the solaris rtl shouldn't  
>>> be that hard either.
>>
>> Could you give me some pointers how to begin?
>
> The wiki page pointed to by Felipe describes the compiler changes fairly  
> well. For the rtl: just copy the contents of rtl/solaris to rtl/aix,  
> and  adapt the files (lookup constants and structure definitions in the  
> C header files and adapt the corresponding Pascal definitions). Apart  
> from rtl/solaris/termio*.*, I think you need everything to get a basic  
> rtl working.
>
> You can avoid having to use assembler for the entry point code by using  
> the same trick that is used for Darwin. Have a look at rtl/bsd/system.pp  
> (search for FPC_DARWIN_JMP_MAIN, which is defined by current compilers  
> -- just copy that entire {$ifdef darwin} block to your own system unit)  
> and add your newly added system_powerpc64_aix identifier to the set of  
> OSes that use this functionality in compiler/ncgutil.pas in the  
> procedure gen_proc_symbol_end (in the if-test).
>
>
> Jonas
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel



More information about the fpc-devel mailing list