From: Mark Kettenis <kettenis@chello.nl>
To: gdb-patches@sources.redhat.com
Subject: [PATCH] Deal with GCC bug on 64-bit SPARC
Date: Sat, 03 Jan 2004 20:46:00 -0000 [thread overview]
Message-ID: <200401032046.i03KkVTt085962@elgar.kettenis.dyndns.org> (raw)
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 <kettenis@gnu.org>
* 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);
+ }
}
}
next reply other threads:[~2004-01-03 20:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-03 20:46 Mark Kettenis [this message]
2004-01-03 22:47 Michael Elizabeth Chastain
2004-01-03 23:00 ` Mark Kettenis
2004-01-03 23:06 Michael Elizabeth Chastain
2004-01-03 23:34 ` Mark Kettenis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200401032046.i03KkVTt085962@elgar.kettenis.dyndns.org \
--to=kettenis@chello.nl \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox