On 11/07/2016 07:29 AM, jhenson1 wrote:
Hi Martin and Jeff, thanks for the feedback - it was good to be able to press
on knowing that it should be possible. I've managed to get to the stage of
being able to build a simple executable by invoking gcc and ld seperately.
e.g. with PREFIX=/cross-compiler and SYSROOT=/cross-compiler/sysroot:
$PREFIX/bin/*gcc -c hello.c
$PREFIX/bin/*ld -o hello $SYSROOT/lib/crt0.o -lc hello.o
Or:
$/PREFIX/bin/*gcc -nodefaultlibs -nostartfiles $SYSROOT/lib/crt0.o -lc
hello.c
This is probably sufficient for my needs but there are some oddities (well,
they seem odd to me at least) which I've detailed below in case they're of
interest to anyone.
Thanks,
Jon
The oddities:
1. ld and gas have to be built explicitly
2. gcc is uanable to link with the built target libgcc
I'm using a combined tree with:
gcc-6.2.0
binutils-2.27
cloog-0.18.1
gmp-6.1.0
isl-0.16.1
mpc-1.0.3
mpfr-3.1.4
To build binutls:
../combined/configure --prefix=/cross-compiler
--with-sysroot=/cross-compiler/sysroot \
--target=powerpc-ibm-aix6.1 --host=x86_64-linux-gnu -v
make all-binutils && make install-binutils
doesn't build gas or ld so I have to additionally issue:
binutils, gas and ld are distinct targets, thus all-binutils just builds
the binutils subdirectory which has things like nm, objdump, objcopy,
etc. It's somewhat confusing.
Just use "make all && make install" Or if you really want to build just
the minimal stuff
"make all-gas all-binutils all-ld && make install-gas install-binutils
install-ld"
This appears to work, however trying to link against it yields:
root@oc5328343620:/tmp# $PREFIX/bin/*gcc hello.c
collect2: fatal error:
/cross-compiler/lib/gcc/powerpc-ibm-aix6.1/6.2.0/libgcc.a: cannot open as
COFF file
compilation terminated.
I'd add "-v -Wl,-v" to get more details about what precisely is being
called.
jeff