aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Kettenis <kettenis@gnu.org>2004-01-03 20:46:30 +0000
committerMark Kettenis <kettenis@gnu.org>2004-01-03 20:46:30 +0000
commit200cc5539f096c8e5bfaee152f694473cb46310b (patch)
tree0f8ff3f5a95ade96ff62ff859807fc44d46f69e7
parentac7b618e105c458ef9c34e8735cf5f17b526fb4d (diff)
downloadgdb-200cc5539f096c8e5bfaee152f694473cb46310b.zip
gdb-200cc5539f096c8e5bfaee152f694473cb46310b.tar.gz
gdb-200cc5539f096c8e5bfaee152f694473cb46310b.tar.bz2
* 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.
-rw-r--r--gdb/ChangeLog4
-rw-r--r--gdb/sparc64-tdep.c15
2 files changed, 19 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9ffebe8..65db16f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
2004-01-03 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.
+
* sparc-sol2-nat.c: Add missing '\'.
* sparc-tdep.c (sparc32_return_value): New function.
diff --git a/gdb/sparc64-tdep.c b/gdb/sparc64-tdep.c
index 1e06ea5..bf3aeca 100644
--- a/gdb/sparc64-tdep.c
+++ b/gdb/sparc64-tdep.c
@@ -668,6 +668,21 @@ sparc64_store_floating_fields (struct regcache *regcache, struct type *type,
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);
+ }
}
}