From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25918 invoked by alias); 3 Jan 2004 20:46:34 -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 25903 invoked from network); 3 Jan 2004 20:46:33 -0000 Received: from unknown (HELO walton.kettenis.dyndns.org) (213.93.115.144) by sources.redhat.com with SMTP; 3 Jan 2004 20:46:33 -0000 Received: from elgar.kettenis.dyndns.org (elgar.kettenis.dyndns.org [192.168.0.2]) by walton.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i03KkWAA001305 for ; Sat, 3 Jan 2004 21:46:32 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: from elgar.kettenis.dyndns.org (localhost [127.0.0.1]) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6) with ESMTP id i03KkVwK085965 for ; Sat, 3 Jan 2004 21:46:31 +0100 (CET) (envelope-from kettenis@elgar.kettenis.dyndns.org) Received: (from kettenis@localhost) by elgar.kettenis.dyndns.org (8.12.6p3/8.12.6/Submit) id i03KkVTt085962; Sat, 3 Jan 2004 21:46:31 +0100 (CET) Date: Sat, 03 Jan 2004 20:46:00 -0000 Message-Id: <200401032046.i03KkVTt085962@elgar.kettenis.dyndns.org> From: Mark Kettenis To: gdb-patches@sources.redhat.com Subject: [PATCH] Deal with GCC bug on 64-bit SPARC X-SW-Source: 2004-01/txt/msg00062.txt.bz2 GCC generates code that doesn't conform to the ABI. Fortunately, we can deal with that lossage in GDB. Patch attached and committed. Mark Index: ChangeLog from Mark Kettenis * sparc64-tdep.c (sparc64_store_floating_fields): If TYPE is a structure that has a single `float' member, store it in %f1 in addition to %f0. Index: sparc64-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v retrieving revision 1.5 diff -u -p -r1.5 sparc64-tdep.c --- sparc64-tdep.c 3 Jan 2004 15:00:10 -0000 1.5 +++ sparc64-tdep.c 3 Jan 2004 20:44:44 -0000 @@ -668,6 +668,21 @@ sparc64_store_floating_fields (struct re sparc64_store_floating_fields (regcache, subtype, valbuf, element, subpos); } + + /* GCC has an interesting bug. If TYPE is a structure that has + a single `float' member, GCC doesn't treat it as a structure + at all, but rather as an ordinary `float' argument. This + argument will be stored in %f1, as required by the psABI. + However, as a member of a structure the psABI requires it to + be stored in. To appease GCC, if a structure has only a + single `float' member, we store its value in %f1 too. */ + if (TYPE_NFIELDS (type) == 1) + { + struct type *subtype = check_typedef (TYPE_FIELD_TYPE (type, 0)); + + if (sparc64_floating_p (subtype) && TYPE_LENGTH (subtype) == 4) + regcache_cooked_write (regcache, SPARC_F1_REGNUM, valbuf); + } } }