diff -Nur elfutils-0.122.orig/backends/Makefile.am elfutils-0.122.cleaned/backends/Makefile.am
--- elfutils-0.122.orig/backends/Makefile.am	2006-08-09 02:33:31.000000000 +0200
+++ elfutils-0.122.cleaned/backends/Makefile.am	2006-08-09 00:40:54.000000000 +0200
@@ -65,7 +65,7 @@
 ia64_SRCS = ia64_init.c ia64_symbol.c
 alpha_SRCS = alpha_init.c alpha_symbol.c alpha_retval.c
 arm_SRCS = arm_init.c arm_symbol.c
-sparc_SRCS = sparc_init.c sparc_symbol.c sparc_regs.c
+sparc_SRCS = sparc_init.c sparc_symbol.c sparc_retval.c sparc_regs.c
 ppc_SRCS = ppc_init.c ppc_symbol.c ppc_retval.c ppc_regs.c
 ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c ppc_regs.c
 s390_SRCS = s390_init.c s390_symbol.c s390_regs.c s390_retval.c
diff -Nur elfutils-0.122.orig/backends/sparc_init.c elfutils-0.122.cleaned/backends/sparc_init.c
--- elfutils-0.122.orig/backends/sparc_init.c	2006-04-13 17:04:56.000000000 +0200
+++ elfutils-0.122.cleaned/backends/sparc_init.c	2006-08-09 02:21:25.000000000 +0200
@@ -56,6 +56,7 @@
   sparc_init_reloc (eh);
   HOOK (eh, reloc_simple_type);
   //HOOK (eh, core_note);
+  HOOK (eh, return_value_location);
   HOOK (eh, register_name);
 
   return MODVERSION;
diff -Nur elfutils-0.122.orig/backends/sparc_retval.c elfutils-0.122.cleaned/backends/sparc_retval.c
--- elfutils-0.122.orig/backends/sparc_retval.c	1970-01-01 01:00:00.000000000 +0100
+++ elfutils-0.122.cleaned/backends/sparc_retval.c	2006-08-09 01:16:23.000000000 +0200
@@ -0,0 +1,157 @@
+/* Function return value location for Linux/sparc ABI.
+   Copyright (C) 2005 Red Hat, Inc.
+   This file is part of Red Hat elfutils.
+
+   Red Hat elfutils is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by the
+   Free Software Foundation; version 2 of the License.
+
+   Red Hat elfutils is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License along
+   with Red Hat elfutils; if not, write to the Free Software Foundation,
+   Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
+
+   Red Hat elfutils is an included package of the Open Invention Network.
+   An included package of the Open Invention Network is a package for which
+   Open Invention Network licensees cross-license their patents.  No patent
+   license is granted, either expressly or impliedly, by designation as an
+   included package.  Should you wish to participate in the Open Invention
+   Network licensing program, please visit www.openinventionnetwork.com
+   <http://www.openinventionnetwork.com>.  */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <assert.h>
+#include <dwarf.h>
+
+#define BACKEND sparc_
+#include "libebl_CPU.h"
+
+
+/* %eax, or pair %eax, %edx.  */
+static const Dwarf_Op loc_intreg[] =
+  {
+    { .atom = DW_OP_reg8 }, { .atom = DW_OP_piece, .number = 4 },
+    { .atom = DW_OP_reg9 }, { .atom = DW_OP_piece, .number = 4 },
+  };
+#define nloc_intreg	1
+#define nloc_intregpair	4
+
+/* $f0, or pair $f0, $f1.  */
+static const Dwarf_Op loc_fpreg[] =
+  {
+    { .atom = DW_OP_regx, .number = 32 }, { .atom = DW_OP_piece, .number = 4 },
+    { .atom = DW_OP_regx, .number = 33 }, { .atom = DW_OP_piece, .number = 4 },
+  };
+#define nloc_fpreg  1
+#define nloc_fpregpair  4
+
+/* The return value is a structure and is actually stored in stack space
+   passed in a hidden argument by the caller.  But, the compiler
+   helpfully returns the address of that space in %eax.  */
+static const Dwarf_Op loc_aggregate[] =
+  {
+    { .atom = DW_OP_breg0, .number = 0 }
+  };
+#define nloc_aggregate 1
+
+int
+sparc_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
+{
+  /* Start with the function's type, and get the DW_AT_type attribute,
+     which is the type of the return value.  */
+
+  Dwarf_Attribute attr_mem;
+  Dwarf_Attribute *attr = dwarf_attr (functypedie, DW_AT_type, &attr_mem);
+  if (attr == NULL)
+    /* The function has no return value, like a `void' function in C.  */
+    return 0;
+
+  Dwarf_Die die_mem;
+  Dwarf_Die *typedie = dwarf_formref_die (attr, &die_mem);
+  int tag = dwarf_tag (typedie);
+
+  /* Follow typedefs and qualifiers to get to the actual type.  */
+  while (tag == DW_TAG_typedef
+	 || tag == DW_TAG_const_type || tag == DW_TAG_volatile_type
+	 || tag == DW_TAG_restrict_type || tag == DW_TAG_mutable_type)
+    {
+      attr = dwarf_attr (typedie, DW_AT_type, &attr_mem);
+      typedie = dwarf_formref_die (attr, &die_mem);
+      tag = dwarf_tag (typedie);
+    }
+
+  switch (tag)
+    {
+    case -1:
+      return -1;
+
+    case DW_TAG_subrange_type:
+      if (! dwarf_hasattr (typedie, DW_AT_byte_size))
+	{
+	  attr = dwarf_attr (typedie, DW_AT_type, &attr_mem);
+	  typedie = dwarf_formref_die (attr, &die_mem);
+	  tag = dwarf_tag (typedie);
+	}
+      /* Fall through.  */
+
+    case DW_TAG_base_type:
+    case DW_TAG_enumeration_type:
+    case DW_TAG_pointer_type:
+    case DW_TAG_ptr_to_member_type:
+      {
+        Dwarf_Word size;
+	if (dwarf_formudata (dwarf_attr (typedie, DW_AT_byte_size,
+					 &attr_mem), &size) != 0)
+	  {
+	    if (tag == DW_TAG_pointer_type || tag == DW_TAG_ptr_to_member_type)
+	      size = 4;
+	    else
+	      return -1;
+	  }
+	if (tag == DW_TAG_base_type)
+	  {
+	    Dwarf_Word encoding;
+	    if (dwarf_formudata (dwarf_attr (typedie, DW_AT_encoding,
+					     &attr_mem), &encoding) != 0)
+	      return -1;
+
+	    if (encoding == DW_ATE_float)
+	      {
+		*locp = loc_fpreg;
+		if (size <= 4)
+		    return nloc_fpreg;
+		if (size <= 8)
+		    return nloc_fpregpair;
+		goto aggregate;
+	      }
+	  }
+	*locp = loc_intreg;
+	if (size <= 4)
+	  return nloc_intreg;
+	if (size <= 8)
+	  return nloc_intregpair;
+
+	/* Else fall through.  */
+      }
+
+    case DW_TAG_structure_type:
+    case DW_TAG_class_type:
+    case DW_TAG_union_type:
+    case DW_TAG_array_type:
+    aggregate:
+      *locp = loc_aggregate;
+      return nloc_aggregate;
+    }
+
+  /* XXX We don't have a good way to return specific errors from ebl calls.
+     This value means we do not understand the type, but it is well-formed
+     DWARF and might be valid.  */
+  return -2;
+}

