From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27023 invoked by alias); 18 Sep 2009 12:50:34 -0000 Received: (qmail 27013 invoked by uid 22791); 18 Sep 2009 12:50:32 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,MSGID_FROM_MTA_HEADER,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mtagate3.de.ibm.com (HELO mtagate3.de.ibm.com) (195.212.17.163) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 18 Sep 2009 12:50:27 +0000 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate3.de.ibm.com (8.13.1/8.13.1) with ESMTP id n8ICoOjL014608 for ; Fri, 18 Sep 2009 12:50:24 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id n8ICoOgH1765442 for ; Fri, 18 Sep 2009 14:50:24 +0200 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n8ICoN9f011214 for ; Fri, 18 Sep 2009 14:50:24 +0200 Received: from tuxmaker.boeblingen.de.ibm.com (tuxmaker.boeblingen.de.ibm.com [9.152.85.9]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with SMTP id n8ICoMmD010948; Fri, 18 Sep 2009 14:50:22 +0200 Message-Id: <200909181250.n8ICoMmD010948@d12av02.megacenter.de.ibm.com> Received: by tuxmaker.boeblingen.de.ibm.com (sSMTP sendmail emulation); Fri, 18 Sep 2009 14:50:22 +0200 Subject: Re: [RFA] Check solib bfd arch To: brobecker@adacore.com (Joel Brobecker) Date: Fri, 18 Sep 2009 12:50:00 -0000 From: "Ulrich Weigand" Cc: teawater@gmail.com (Hui Zhu), gdb-patches@sourceware.org (gdb-patches ml), msnyder@vmware.com (Michael Snyder) In-Reply-To: <20090917225633.GA29769@adacore.com> from "Joel Brobecker" at Sep 17, 2009 03:56:33 PM MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-09/txt/msg00586.txt.bz2 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