summaryrefslogtreecommitdiffstats
path: root/backends/s390_retval.c
diff options
context:
space:
mode:
Diffstat (limited to 'backends/s390_retval.c')
-rw-r--r--backends/s390_retval.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/backends/s390_retval.c b/backends/s390_retval.c
index b671ee86..a927d46a 100644
--- a/backends/s390_retval.c
+++ b/backends/s390_retval.c
@@ -1,5 +1,5 @@
/* Function return value location for S/390 ABI.
- Copyright (C) 2006, 2007 Red Hat, Inc.
+ Copyright (C) 2006, 2007, 2014 Red Hat, Inc.
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -68,27 +68,10 @@ s390_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_integrate (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_OR_RETURN (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_integrate (typedie, DW_AT_type, &attr_mem);
- typedie = dwarf_formref_die (attr, &die_mem);
- tag = DWARF_TAG_OR_RETURN (typedie);
- }
+ Dwarf_Die die_mem, *typedie = &die_mem;
+ int tag = dwarf_peeled_die_type (functypedie, typedie);
+ if (tag <= 0)
+ return tag;
Dwarf_Word size;
switch (tag)
@@ -99,6 +82,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
case DW_TAG_subrange_type:
if (! dwarf_hasattr_integrate (typedie, DW_AT_byte_size))
{
+ Dwarf_Attribute attr_mem, *attr;
attr = dwarf_attr (typedie, DW_AT_type, &attr_mem);
typedie = dwarf_formref_die (attr, &die_mem);
tag = DWARF_TAG_OR_RETURN (typedie);
@@ -115,6 +99,7 @@ s390_return_value_location (Dwarf_Die *functypedie, const Dwarf_Op **locp)
if (dwarf_diecu (typedie, &cudie, &asize, NULL) == NULL)
return -1;
+ Dwarf_Attribute attr_mem;
if (dwarf_formudata (dwarf_attr (typedie, DW_AT_byte_size,
&attr_mem), &size) != 0)
{