Sign in Join
Wiki copytemporary

FPC AIX Port: what changed

Revision 3 to 4. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11# Overview
22
33As of revision 20851, FPC svn trunk supports targeting the AIX operating system.
44
55AIX is a UNIX platform and hence treated like one by FPC. As of revision 21053, FPC can create both AIX/PowerPC 32 bit and AIX/PowerPC64 applications and libraries. Note that gcc and xlc on AIX by default generate 32 bit code. The reason is that on PowerPC, 32 bit programs are usually faster and use less memory than 64 bit ones.
66
77# Snapshots
88
99An initial snapshot is available in two flavours: a native AIX compiler, and a cross-compiler from Windows. Note that these are not compiled from the version that was committed to svn, but from a slightly older version. It is unlikely that future binary snapshots will be created (unless someone volunteers), but as of the next major release, (native) AIX compilers will be included;
1010
1111- [Native AIX/PowerPC snapshot](ftp://ftp.freepascal.org/pub/fpc/contrib/aix/fpc-2.7.1.powerpc-aix-native-snapshot1.tbz)
1212- [Win32-\>AIX/PowerPC cross-snapshot](ftp://ftp.freepascal.org/pub/fpc/contrib/aix/fpc-2.7.1.powerpc-aix-win32.zip) (including cross-binutils -- **Warning**: FPC 3.0 and later require [newer binutils](ftp://ftp.freepascal.org/pub/fpc/contrib/aix/binutils%202.25.1-powerpc-aix-win32.zip))
1313
1414# Port information
1515
1616## Required helper tools
1717
1818To compile the compiler on AIX, you must have the AIX assembler and linker installed, as well as GNU diffutils and GNU make.
1919
2020To cross-compile from other platforms, you need the GNU BinUtils configured as follows:
2121
22-` ./configure --target=powerpc-ibm-aix5.3 --with-sysroot`
22+```text
23+ ./configure --target=powerpc-ibm-aix5.3 --with-sysroot
24+```
2325
2426Note that the extra "5.3" at the end is required. Afterwards, rename the generated binaries from *powerpc-ibm-aix5.3-as* etc to *powerpc-aix-as*, as those are the names that the compiler expects (*-XPpowerpc-ibm-aix5.3-* won't work, as the compiler currently does not support dots in prefixes).
2527
2628## Debugger
2729
2830AIX uses its own debugging format, Stabx. As the name implies, this is a variant of the regular Stabs format, but it has some differences. GDB on AIX does not fully support the Stabx format, but instead supports a hybrid format between regular Stabs and Stabx, which is also generated by GCC. FPC generates this same hybrid information. The result is that FPC-generated binaries compiled with debug information can be debugged by GDB on AIX, but not (fully) by DBX, the native AIX debugger.
2931
3032The default GDB compiles without any problems on AIX. A compiled version of GDB 7.3.1 for AIX can also be downloaded from [our ftp site](ftp://ftp.freepascal.org/pub/fpc/contrib/aix/gdb-7.3.1-aix5.3.tar.bz2).
3133
3234## Line info unit for symbolicating backtraces
3335
3436No support has been added (yet) for the AIX debugging format (Stabx) to the lineinfo unit. Instead, when compiling with -gl, the resulting binary will launch gdb to symbolicate backtraces. This can cause trouble if you are debugging a program compiled with -gl, since this newly launched will not be able to attach to the process in that case. The reason is that a process can only be debugged by one debugger at a time.
3537
3638## Assembler/linker
3739
3840When compiling/linking an AIX program/library on a platform other than AIX, FPC assumes that the used assembler and linker are from the GNU BinUtils. When compiling/linking an AIX program/library on AIX itself, only the native AIX assembler and linker are supported. The reason is that the native and GNU BinUtils linker require the object files to be specified in a different way, and we differentiate between the two based on the target OS on which the program has to be linked.
3941
4042## Cross-compiling
4143
4244When cross-compiling, you not only need cross-BinUtils as explained above, but also a copy of the AIX libraries from the target system. These libraries are located in */usr/lib* on the AIX system. On your build system, create a directory hierarchy like this:
4345
44-` aixroot/`\
45-` aixroot/usr/`\
46-` aixroot/usr/lib/`
46+```text
47+ aixroot/
48+ aixroot/usr/
49+ aixroot/usr/lib/
50+```
4751
4852After copying the contents of */usr/lib* on the AIX system to *aixroot/usr/lib* to your build system, create a symbolic link called *lib* in the *aixroot* directory that points to *usr/lib*. If you are on a system that does not support symbolic links, you can simply create a directory called *lib* in *aixroot* and copy *usr/lib/*.o* into this *lib* directory.
4953
5054Finally, when compiling for AIX always specify the full path to this *aixroot* directory via *-XR/full/path/to/aixroot* to the compiler.
5155
5256## Supported OS versions
5357
5458IBM supports backward compatibility as long as you only use the system libraries for OS interfacing, which is what FPC does. The compiler and test suite have been verified as working on AIX 5.3, and hence should work on AIX 5.3 and later.
5559
5660# AIX quirks
5761
5862## Reading from NULL pointers
5963
6064AIX does **not** raise an exception when reading from NULL pointers and other low addresses (up to 16KB on a test system, but there is no documentation about the upper limit). The reason is that this allows compilers to speculatively dereference pointers while scheduling code before NULL pointer checks. Writing to NULL pointers or other low addresses will still result in segmentation faults like on other supported platforms.
6165
6266There is no system option to disable this behaviour. Since IBM's compiler makes extensive use of this property, doing so would result in many application crashes anyway since the system libraries have been compiled with this assumption.
6367
6468FPC has added an extra code generation option titled -CN that instructs the compiler to add additional code to check that memory reads do not load data from such low addresses. If such an access is detected, a run time error 216 will be raised.
6569
6670## Unicode/code page support
6771
6872Like on other UNIX and UNIX-like platforms, for unicodestring support FPC requires that libiconv functionality is available. On AIX, this library is not always installed by default. If it is not available, you can install it using the *bos.rte.iconv* package. Also install the *bos.iconv.ucs.pc* package if you want to support common Windows code pages.
6973
7074AIX' libiconv is somewhat more limited than libiconv on most other platforms. In particular, its libiconv supports code page 866 only when converting from or to ISO-8859-5. These code pages both support the same Cyrillic characters, but are different in terms of special characters. This means that converting from UTF-8/16/32 to code page 866 will be lossy as far as those special characters are concerned.
7175
7276## Maximum number of processes/threads
7377
7478By default, the maximum number of processes per user may be fairly limited (128 on a test system). Individual threads count as a process in this context. You can increase this limit by executing *smit chgsys* as superuser and then changing the *Maximum number of PROCESSES allowed per user* setting.
7579
7680## Maximum amount of memory per process
7781
7882By default, the maximum amount of memory that a single process can allocate may be fairly limited (128MB on a test system). You can increase this amount by setting the *LDR_CNTRL* environment variable. E.g., *export LDR_CNTRL=MAXDATA=0x20000000* in a Bourne sh-compatible shell will increase this amount to 256MB. See [IBM's site](http://publib.boulder.ibm.com/infocenter/javasdk/v6r0/index.jsp?topic=%2Fcom.ibm.java.doc.user.aix32.60%2Fuser%2Faix_auto_ldr_cntrl.html) for more information.
7983
8084## Shared library initialisation order
8185
8286AIX does not guarantee the order in which dynamic libraries are loaded and initialised. In particular, its dynamic linker/loader does not follow library dependency chains and will not automatically initialise dependent libraries before others. AIX does however allow you to manually [define priorities](http://publib.boulder.ibm.com/infocenter/comphelp/v111v131/index.jsp?topic=%2Fcom.ibm.xlcpp111.aix.doc%2Fproguide%2Finit_module.html) for each library to influence this initialization order. Getting this to work properly is however not easy.
8387
8488# Getting access to an AIX system
8589
8690## Via the GCC compile farm
8791
8892The [GCC compile farm](http://gcc.gnu.org/wiki/CompileFarm) offers free accounts to all developers of free and open source software packages for testing. Recently they added an AIX server to the pool of available machines. Note that many of the GNU utilities required to build and test FPC are not installed on that machine. You can work around that by adding */home/muller/bin* to your path :)
8993
9094## Via IBM
9195
9296Companies can register (for free) to become a member of the [IBM PartnerWorld program](http://www.ibm.com/partnerworld). The only downside is that you cannot disable getting their (regular) commercial emails on your primary contact address.
9397
9498Once you are a PartnerWorld member, you can (for free) make use of their [Power Development Program](http://www.ibm.com/partnerworld/wps/pub/systems/vlp). This program provides you with remote access via VPN to virtual machines running various versions of or Linux and AIX on various kinds of POWER processors (POWER 5, 6, 7 and 8). You have full root access to these VMs, and they can run continuously for up to 14 days at a time. You can however (automatically) save the contents of your virtual disk image on IBM's servers for use during subsequent reservations.
9599
96100---
97101*From the Free Pascal wiki, page "FPC AIX Port", as it stood on 2016-01-21 after a change by Jonas, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
98102Category: AIX
99103Category: FPC

Back to history