This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Check solib bfd arch
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: brobecker at adacore dot com (Joel Brobecker)
- Cc: teawater at gmail dot com (Hui Zhu), gdb-patches at sourceware dot org (gdb-patches ml), msnyder at vmware dot com (Michael Snyder)
- Date: Fri, 18 Sep 2009 14:50:22 +0200 (CEST)
- Subject: Re: [RFA] Check solib bfd arch
Joel Brobecker wrote:
> I now see:
>
> (gdb) run
> Starting program: /[...]/sparc64/ex/task_switch
> warning: `/usr/platform/SUNW,Sun-Fire-V440/lib/sparcv9/libc_psr.so.1': Shared library architecture sparc:v9a is not compatible with target architecture sparc:v9.
>
> > + if (b->compatible (b, bfd_get_arch_info (abfd)) != b)
>
> In my case, b->compatible is bfd_default_compatible. the architecture
> is set to sparc:v9, and the shared library's architecture is sparc:v9a.
> The problem is that b->compatible is returning the architecture that
> is "more featureful" of the two, which in this case is sparc:v9a.
> As a result, we emit the warning.
>
> Looks to me like the check is too aggressive and should be changed
> to == 0. Would that be correct?
Well, the check is modeled after the one in osabi.c:can_run_code_for
which carries the comment:
/* BFD's 'A->compatible (A, B)' functions return zero if A and B are
incompatible. But if they are compatible, it returns the 'more
featureful' of the two arches. That is, if A can run code
written for B, but B can't run code written for A, then it'll
return A.
In your particular case, the result of compatible appears to indicate
that the target architecture sparc:v9 *cannot* run code written for
the architecture sparc:v9a; if this were true (I'm not sure about
such sparc architecture details), then it would be correct to reject
those shared libraries ...
In any case, I do not think the checks in osabi.c (for the main
executable) and in solib.c (for shared libraries) should be different.
Hui Zhu wrote:
> Could you please try it with "bfd_arch_rs6000 and bfd_arch_powerpc"?
> Or Ulrich, maybe you can help us with it. :)
Unfortunately, I don't have access to an old-style RS/6000 machine
myself ...
Bye,
Ulrich
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com