Re: [PATCH 5/5] ARM: asm-source.exp link options in case of armv7b target

Yao Qi
2014-10-24T08:57:12Z

Andrew Pinski <pinskia@gmail.com> writes:

>> Any executable/library that runs on big endian V7 *must* be linked
>> with -be8 option. Otherwise it simply won't run. In any other multilib
>> option vfp, neon, etc -be8 must be set. Basically, in big endian case
>> gcc/gas generates data and instructions in big endian
>> format but ARM V7 requires that instruction should be little endian
>> format. It is linker that does instructions byte swap. If -be8 flag
>> is not passed during link while running on ARM V7 big endian target
>> executable with crash with SIGILL. If link happens through gcc, then
>> -be8 always passed for non relocatable code by compiler. In this
>> particular case link happens directly with linker and -be8 is not
>> default, so it is needed. One may argue that -be8 for final
>> executables in ARM V7 BE target should be default even for
>> linker, but it is not the current case ...
>>
>> Also note that you have plenty examples in the same test
>> gdb/testsuite/gdb.asm/asm-source.exp
>> that do very similar things. For example:
>>
>> "powerpc64le-*" {
>> set asm-arch powerpc64le
>> set asm-flags "-a64 -I${srcdir}/${subdir} $obj_include"
>> append link-flags " -m elf64lppc"
>> }
>>
>> Why "-m elf64lppc" is set for powerpc64le target? I suspect
>> by very similar reasons.
>
>
> Yes and no. For PowerPC64 little-endian is Linux only so it will
> never have a multi-libs that support both little-endian and
> big-endian. While for arm*-*-*, you can have a bare metal env and
> that could have a multi-lib for both little and big endian.

Andrew is right. We can have a arm-linux-gnueabi toolchain which has
multilibs for the combination of {le, be} x {armv7, armv6, armv5}, and
this test still fails on armv7 be multilib.

--
Yao (齐尧)