From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17788 invoked by alias); 24 Oct 2003 15:43:54 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 17781 invoked from network); 24 Oct 2003 15:43:53 -0000 Received: from unknown (HELO localhost.redhat.com) (207.219.125.105) by sources.redhat.com with SMTP; 24 Oct 2003 15:43:53 -0000 Received: from redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 2ED612B89 for ; Fri, 24 Oct 2003 11:43:54 -0400 (EDT) Message-ID: <3F9948BA.4050201@redhat.com> Date: Fri, 24 Oct 2003 15:43:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 X-Accept-Language: en-us, en MIME-Version: 1.0 To: gdb-patches@sources.redhat.com Subject: [obish] More osabi comments Content-Type: multipart/mixed; boundary="------------040500090601020708010007" X-SW-Source: 2003-10/txt/msg00734.txt.bz2 This is a multi-part message in MIME format. --------------040500090601020708010007 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 346 More comments the better ... Recent discussions to do with rs6000 compatibility left me wondering how come "amd64 can run code for i386" wasn't getting a hit. The attached comment explains why the test (both old and new) works for the 32-bit vs 64-bit case. I also changed "atom" to the more common OO term "singleton". committed, Andrew --------------040500090601020708010007 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 1864 2003-10-24 Andrew Cagney * osabi.c (gdbarch_init_osabi): Add comment on 32-bit vs 64-bit. (can_run_code_for): Use the OO term "singleton". Index: osabi.c =================================================================== RCS file: /cvs/src/src/gdb/osabi.c,v retrieving revision 1.18 diff -u -r1.18 osabi.c --- osabi.c 23 Oct 2003 21:15:50 -0000 1.18 +++ osabi.c 24 Oct 2003 15:35:26 -0000 @@ -295,9 +295,9 @@ written for B, but B can't run code written for A, then it'll return A. - struct bfd_arch_info objects are atoms: that is, there's supposed - to be exactly one instance for a given machine. So you can tell - whether two are equivalent by comparing pointers. */ + struct bfd_arch_info objects are singletons: that is, there's + supposed to be exactly one instance for a given machine. So you + can tell whether two are equivalent by comparing pointers. */ return (a == b || a->compatible (a, b) == a); } @@ -333,6 +333,14 @@ type that is compatible with the desired machine type. Right now we simply return the first match, which is fine for now. However, we might want to do something smarter in the future. */ + /* NOTE: cagney/2003-10-23: The code for "a can_run_code_for b" + is implemented using BFD's compatible method (a->compatible + (b) == a -- the lowest common denominator between a and b is + a). That method's definition of compatible may not be as you + expect. For instance, while "amd64 can run code for i386" + (or more generally "64-bit ISA can run code for the 32-bit + ISA"). Fortunatly, BFD doesn't normally consider 32-bit and + 64-bit "compatible" so won't get a match. */ if (can_run_code_for (arch_info, handler->arch_info)) { (*handler->init_osabi) (info, gdbarch); --------------040500090601020708010007--