[Linuxppc-users] Little endian linker options

Ben Hood ben at relops.com
Thu Nov 8 06:31:05 AEDT 2018


Hi list,

I’m trying to cross compile a bunch of stuff on CentOS7 x86_64 for ppc64le. The resultant binaries appear to be in big endian ppc64 format instead of little.

So to break things down, I’ve tried to create a little endian binary for a hello world app:

$ /opt/at12.0/bin/powerpc64-linux-gnu-gcc -mcpu=powerpc64le -Wl,-m,elf64lppc,-EL hello.c
/opt/at12.0/bin/powerpc64-linux-gnu-ld: /opt/at12.0/lib/gcc/powerpc64-linux-gnu/8.2.1/../../../../powerpc64-linux-gnu/lib/../lib64/libgcc_s.so.1: error adding symbols: file in wrong format
collect2: error: ld returned 1 exit status

However, I specify -EB instead of -EL, the compilation succeeds and readelf tells me the output is ppc64 big endian:

$ /opt/at12.0/bin/powerpc64-linux-gnu-gcc -mcpu=powerpc64le -Wl,-m,elf64lppc,-EB hello.c

Does anybody know how to get the toolchain to generate in little endian format?

Many thanks in advance,

Ben


More information about the Linuxppc-users mailing list