How to identify Arch info when building

Matthew Gretton-Dann matthew.gretton-dann@linaro.org
Wed Oct 31 21:52:00 GMT 2012


This is a linker issue, and best asked on binutils@sourceware.org.

On 31 October 2012 12:58, naveen yadav <yad.naveen@gmail.com> wrote:
> Hi All,
>
> I have two ARM arch (A9 and A15). and have cross compiler for both.
>
> Since code is integrated, some time .so got mixed(A9 with A15), and at
> run time it fails with undefined instruction.
>
> Is there any way to check strict at build time, we through an error.
>
> Scenario.
>
> (A15 code) + A9(.so)= executable when run on target (undefined instruction)
>
>  Tag_CPU_name: "Cortex-A15"
>   Tag_CPU_arch: v7
>   Tag_CPU_arch_profile: Application
>   Tag_ARM_ISA_use: Yes
>
>
>   Tag_CPU_name: "Cortex-A9"
>   Tag_CPU_arch: v7
>   Tag_CPU_arch_profile: Application

It is unclear where the different attributes above are coming from.

The linker's checking for incompatibilities between objects is
restricted to examples like 'size of wchar_t == 2' is incompatible
with 'size of wchar_t == 4'.  In this case it is obvious that these
two objects will never work together.

When it encounters two objects where one uses features that are not
used in another (as for instance if you link objects for Cortex-A9
which doesn't have integer-divide, and objects for Cortex-A15 which
does) the linker assumes the user wants to run the code on the most
'feature'-ful.

There is no way to tell the linker which CPU you intend to run the code on.

What you may be able to do (and I make no guarantees here) is add a
stage to your build which checks the attributes on the generated .so
after link to make sure that they match what you want.

Thanks,

Matt

-- 
Matthew Gretton-Dann
Linaro Toolchain Working Group
matthew.gretton-dann@linaro.org



More information about the Gcc-help mailing list