Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Deal with GCC bug on 64-bit SPARC
@ 2004-01-03 20:46 Mark Kettenis
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2004-01-03 20:46 UTC (permalink / raw)
  To: gdb-patches

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);
+	}
     }
 }
 


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] Deal with GCC bug on 64-bit SPARC
@ 2004-01-03 22:47 Michael Elizabeth Chastain
  2004-01-03 23:00 ` Mark Kettenis
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-03 22:47 UTC (permalink / raw)
  To: gdb-patches, kettenis

> GCC generates code that doesn't conform to the ABI.

I hate it when that happens.

Can you enhance your comment to say which version of gcc?
gcc 3.4 has a different default ABI than gcc 3.3.
 
Michael C


^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re: [PATCH] Deal with GCC bug on 64-bit SPARC
@ 2004-01-03 23:06 Michael Elizabeth Chastain
  2004-01-03 23:34 ` Mark Kettenis
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Elizabeth Chastain @ 2004-01-03 23:06 UTC (permalink / raw)
  To: kettenis, mec.gnu; +Cc: gdb-patches

> I've seen this with GCC 3.3.2, GCC 3.3.3-ish and GCC 3.4.  But I bet
> older versions have this problem too.

That's what I'd like to see in the source code.  So that four years
from now, when we're worrying about gcc 4.1, we know that it's an
old comment and not a current comment.

Michael C


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2004-01-03 23:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-03 20:46 [PATCH] Deal with GCC bug on 64-bit SPARC Mark Kettenis
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox