--- solib.c | 10 ++++++++++ 1 file changed, 10 insertions(+) --- a/solib.c +++ b/solib.c @@ -289,6 +289,7 @@ solib_bfd_open (char *pathname) char *found_pathname; int found_file; bfd *abfd; + const struct bfd_arch_info *b; /* Use target-specific override if present. */ if (ops->bfd_open) @@ -311,6 +312,15 @@ solib_bfd_open (char *pathname) found_pathname, bfd_errmsg (bfd_get_error ())); } + /* Check bfd arch. */ + b = gdbarch_bfd_arch_info (target_gdbarch); + if (b->compatible (b, bfd_get_arch_info (abfd)) != b) + { + bfd_close (abfd); + make_cleanup (xfree, found_pathname); + error (_("`%s': ARCH not same with inferior."), found_pathname); + } + return abfd; }