[Linuxppc-users] Little endian linker options
Ben Hood
ben at relops.com
Thu Nov 8 06:55:34 AEDT 2018
Hi Segher,
I wasn’t even aware there was a toolchain specific to LE - sounds like installing that would make a difference.
I’ll give that a go and report back.
Many thanks for the heads up :-)
Ben
> On 7 Nov 2018, at 19:43, Segher Boessenkool <segher at linux.ibm.com> wrote:
>
> Hi Ben,
>
> On Wed, Nov 07, 2018 at 07:31:05PM +0000, Ben Hood wrote:
>> 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?
>
> You should use the powerpc64le-linux-gnu toolchain instead.
>
> HTH,
>
>
> Segher
>
More information about the Linuxppc-users
mailing list