I'm trying to build GCC as a cross-compiler for AIX; the host and the build platforms are Linux x86_64, the target is powerpc-aix5.2.0. I've managed to cross-compile Binutils 2.20.1 and GCC 4.4.7 with native AIX 6.1 headers (from /usr/include) and libs (only /usr/lib/{crt0.o,crt0_64.o,libc.a,libc_r.a,libpthreads.a}). Then gcc correctly cross-builds simple C code (such as "Hello, world!") into stand-alone executables but it refuses to cross-build shared objects:
collect2: init function found in object < path to cross-compiled libgcc_s.a >
I tried using newer versions of Binutils up to 2.26 with the same result.
Then I found the following comment:
Binutils was updated to support AIX 4.3.3, but has not been maintained, improved, or updated for AIX 5. It can do simple things, but does not fully support more advanced features. For instance, some aspects of shared object creation are not complete.
So I tried re-building the above toolchain with target=powerpc-aix4.3.0 (the only difference this time was that I configured GCC with --disable-multilib to avoid the error "Unrecognized opcode: `fmsub'"). I tried both Binutils 2.20.1 and Binutils 2.26 but I still got the error init function found in object libgcc_s.a.
Now I wonder if there is a version of AIX for which cross-compilation, esp. of shared objects, is supported by GCC and Binutils.
The answer to your question is "no". As the comment says, the GCC version of the linker (ld) does not really work for AIX. All of the open source code that I compile on AIX I use GCC but I use the native ld command.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With