Help with AIX 6.1

James Reynolds james.reynolds@cristie.com
Mon Apr 9 14:34:00 GMT 2018


Hi all,

I'm working on getting AIX 6.1 support working, or at least, mostly
working, so I can create a cross-compiler for our CI tool-chain. To
begin with I'd just like to be able to compile and link so that I can
catch simple missed-include or platform-specific typos. So far I've got
32-bit C++ code compiling, linking and running for some reasonable C++
programs with exceptions and inheritance across multiple object files.
I'm collecting all of my changes together in a fork on github that I
can ship over in a series of patches when complete.

Unfortunately I've got stuck dynamically linking AIX milicode (https://
www.ibm.com/support/knowledgecenter/en/ssw_aix_71/com.ibm.aix.alangref/
idalangref_milicode_routines.htm). The generated assembly will link
using the AIX linker and create a working binary but the binutils
version will crash with an illegal instruction.

Is anyone able to lend a hand with this code? The last major AIX-
specific modifications to xcofflink.c were a very long time ago (2009)
by Richard Sandiford so much of this is rather out of date.

My current understanding of the problem (using memset as the function
requiring milicode) is:

The AIX milicode routines use both an R_RBA relocation to jump to an
absolute location in the kernel. This causes the AIX linker puts
".___memset" in the TOC but also adds the definition "___memset" into
the TOC and "___memset" into the loader table as an XMC_XO symbol. I
think I need to add the XMC_XO loader symbol entries and TOC entries
from libc.a(shr.o) then rely on the garbage collection to destroy those
that aren't required later. This appears to be a large job though as
the TOC entries do not have relocs associated with them and generating
a TOC entry without a reloc is difficult within the current code
layout.

I've managed to add a new loader symbol for an XMC_XO but generating a
new TOC entry without an associated reloc is not easy. I'm likely to be
able to eventually struggle my way through this but if anyone has any
insights into the AIX linking mechanisms I would greatly appreciate
some help!

Thanks,
James


More information about the Binutils mailing list