summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMark Wielaard <mark@klomp.org>2023-01-26 18:19:15 +0100
committerMark Wielaard <mark@klomp.org>2023-02-14 16:30:24 +0100
commitf2c522567ad63ac293535fba9704895e685ab5bc (patch)
tree667604fa01006ac0b8041d156dbd9d345bcb0d17 /tests
parent3fa98a6f29b0f370e32549ead7eb897c839af980 (diff)
downloadelfutils-f2c522567ad63ac293535fba9704895e685ab5bc.tar.gz
backends: Handle DW_TAG_unspecified_type in dwarf_peeled_die_type
binutils 2.40 introduces DW_TAG_unspecified_type for assembly functions with an unknown return type. This breaks the run-funcretval.sh testcase because dwfl_module_return_value_location returns an error for such functions because it cannot determine the return value location. Fix that by treating DW_TAG_unspecified_type as if the DIE doesn't have a DW_AT_type. Also update the testcase to explicitly checking for DW_TAG_unspecified_type and printing "returns unspecified type". https://sourceware.org/bugzilla/show_bug.cgi?id=30047 Signed-off-by: Mark Wielaard <mark@klomp.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/ChangeLog5
-rw-r--r--tests/funcretval.c14
2 files changed, 18 insertions, 1 deletions
diff --git a/tests/ChangeLog b/tests/ChangeLog
index 974a3a4f..89f1a991 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,8 @@
+2023-02-07 Mark Wielaard <mark@klomp.org>
+
+ * tests/funcretval.c (handle_function): Check for
+ DW_TAG_unspecified_type.
+
2023-02-03 Mark Wielaard <mark@klomp.org>
* run-addr2line-C-test.sh: Check ELFUTILS_DISABLE_DEMANGLE.
diff --git a/tests/funcretval.c b/tests/funcretval.c
index 16cd1a44..41198ab7 100644
--- a/tests/funcretval.c
+++ b/tests/funcretval.c
@@ -1,5 +1,6 @@
/* Test program for dwfl_module_return_value_location.
Copyright (C) 2005 Red Hat, Inc.
+ Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org>
This file is part of elfutils.
This file is free software; you can redistribute it and/or modify
@@ -67,7 +68,18 @@ handle_function (Dwarf_Die *funcdie, void *arg)
error (EXIT_FAILURE, 0, "dwfl_module_return_value_location: %s",
dwfl_errmsg (-1));
else if (nlocops == 0)
- puts ("returns no value");
+ {
+ // Check if this is the special unspecified type
+ // https://sourceware.org/bugzilla/show_bug.cgi?id=30047
+ Dwarf_Die die_mem, *typedie = &die_mem;
+ Dwarf_Attribute attr_mem, *attr;
+ attr = dwarf_attr_integrate (funcdie, DW_AT_type, &attr_mem);
+ if (dwarf_formref_die (attr, typedie) != NULL
+ && dwarf_tag (typedie) == DW_TAG_unspecified_type)
+ puts ("returns unspecified type");
+ else
+ puts ("returns no value");
+ }
else
{
printf ("return value location:");