This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 5/5] ARM: asm-source.exp link options in case of armv7b target
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Victor Kamensky <victor dot kamensky at linaro dot org>
- Cc: Yao Qi <yao at codesourcery dot com>, "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Thu, 23 Oct 2014 23:38:33 -0700
- Subject: Re: [PATCH 5/5] ARM: asm-source.exp link options in case of armv7b target
- Authentication-results: sourceware.org; auth=none
- References: <1413853021-4393-1-git-send-email-victor dot kamensky at linaro dot org> <1413853021-4393-6-git-send-email-victor dot kamensky at linaro dot org> <87siievw6z dot fsf at codesourcery dot com> <CAA3XUr3eDYiCAG3rSwn_4kR2gW7UsPBB++KLBFZvMgg3qOb4cw at mail dot gmail dot com>
On Thu, Oct 23, 2014 at 11:35 PM, Victor Kamensky
<victor.kamensky@linaro.org> wrote:
> Hi Yao,
>
> On 23 October 2014 23:05, Yao Qi <yao@codesourcery.com> wrote:
>> Victor Kamensky <victor.kamensky@linaro.org> writes:
>>
>>> + "armv7b-*-*" {
>>> + set asm-arch arm
>>> + append link-flags " -be8"
>>> + }
>>
>> We can't tell whether "-be8" is needed from the target triplet.
>> Considering multi-lib, "-be8" is needed for one multilib, but not
>> for the other.
>
> 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.
This is true for MIPS too.
Thanks,
Andrew Pinski
>
>> Maybe, you can fix your problem by running tests via LDFLAGS_FOR_TARGET,
>>
>> $ make check RUNTESTFLAGS='LDFLAGS_FOR_TARGET=-be8'
>>
>> or you can create your own board file foo.exp, and add
>>
>> set_board_info ldflags "-be8"
>
> I don't feel very strong about it, and definitely I can workaround
> this issue or just ignore the failure. It just seemed that it was very
> easy to fix.
>
> If you are still not convinced by above argument, yes,
> let's just drop it. Please let me know you final thoughts. We
> will proceed accordingly. I am fine either way.
>
> Thanks,
> Victor
>
>> $ make check RUNTESTFLAGS='--target_board=foo'
>>
>> --
>> Yao (éå)