This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Check solib bfd arch
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Hui Zhu <teawater at gmail dot com>
- Cc: Ulrich Weigand <uweigand at de dot ibm dot com>, gdb-patches ml <gdb-patches at sourceware dot org>, Michael Snyder <msnyder at vmware dot com>
- Date: Thu, 17 Sep 2009 15:56:33 -0700
- Subject: Re: [RFA] Check solib bfd arch
- References: <daef60380907052003q3a291a00r83659e46c0cdfdaf@mail.gmail.com> <200907071645.n67GjR0X001418@d12av02.megacenter.de.ibm.com> <daef60380907071946j414bf12fub984540640102edc@mail.gmail.com>
Hello,
The following patch is causing trouble on sparc-solaris:
> 2009-07-08 Hui Zhu <teawater@gmail.com>
>
> * solib.c (solib_bfd_open): Output a warning if solib's
> architecture is not compatible with inferior's architecture.
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?
2009-09-16 Joel Brobecker <brobecker@adacore.com>
* solib.c (solib_bfd_open): Relax a bit the compatibility check.
Tested on sparc64-solaris.
--
Joel
diff --git a/gdb/solib.c b/gdb/solib.c
index c7fd0fc..a2ad0c4 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -310,7 +310,7 @@ solib_bfd_open (char *pathname)
/* Check bfd arch. */
b = gdbarch_bfd_arch_info (target_gdbarch);
- if (b->compatible (b, bfd_get_arch_info (abfd)) != b)
+ if (!b->compatible (b, bfd_get_arch_info (abfd)))
warning (_("`%s': Shared library architecture %s is not compatible "
"with target architecture %s."), found_pathname,
bfd_get_arch_info (abfd)->printable_name, b->printable_name);