Compare commits
3 Commits
ae0fc5b66c
...
3ab1a29afa
Author | SHA1 | Date |
---|---|---|
David Abdurachmanov | 3ab1a29afa | |
David Abdurachmanov | de40b01d44 | |
Aaron Merey | 0aecb034b0 |
|
@ -0,0 +1,138 @@
|
|||
From f2c522567ad63ac293535fba9704895e685ab5bc Mon Sep 17 00:00:00 2001
|
||||
From: Mark Wielaard <mark@klomp.org>
|
||||
Date: Thu, 26 Jan 2023 18:19:15 +0100
|
||||
Subject: [PATCH] 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>
|
||||
---
|
||||
NEWS | 5 +++++
|
||||
backends/ChangeLog | 5 +++++
|
||||
backends/libebl_CPU.h | 14 ++++++++++++--
|
||||
tests/ChangeLog | 5 +++++
|
||||
tests/funcretval.c | 14 +++++++++++++-
|
||||
5 files changed, 40 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/NEWS b/NEWS
|
||||
index 71534b8c..80faca39 100644
|
||||
--- a/NEWS
|
||||
+++ b/NEWS
|
||||
@@ -1,3 +1,8 @@
|
||||
+Version 0.189
|
||||
+
|
||||
+libdwfl: dwfl_module_return_value_location now returns 0 (no return type)
|
||||
+ for DIEs that point to a DW_TAG_unspecified_type.
|
||||
+
|
||||
Version 0.188
|
||||
|
||||
readelf: Add -D, --use-dynamic option.
|
||||
diff --git a/backends/ChangeLog b/backends/ChangeLog
|
||||
index 40ec7c0c..81f08314 100644
|
||||
--- a/backends/ChangeLog
|
||||
+++ b/backends/ChangeLog
|
||||
@@ -1,3 +1,8 @@
|
||||
+2023-02-07 Mark Wielaard <mark@klomp.org>
|
||||
+
|
||||
+ * libebl_CPU.h (dwarf_peeled_die_type): Explicitly handle
|
||||
+ DW_TAG_unspecified_type as if there was no DW_AT_type.
|
||||
+
|
||||
2023-01-19 Mark Wielaard <mark@klomp.org>
|
||||
|
||||
* sparc_reloc.def (NONE): Add EXEC and DYN.
|
||||
diff --git a/backends/libebl_CPU.h b/backends/libebl_CPU.h
|
||||
index 2abad76f..3b2cc3e4 100644
|
||||
--- a/backends/libebl_CPU.h
|
||||
+++ b/backends/libebl_CPU.h
|
||||
@@ -1,5 +1,6 @@
|
||||
/* Common interface for libebl modules.
|
||||
Copyright (C) 2000, 2001, 2002, 2003, 2005, 2013, 2014 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
|
||||
@@ -53,7 +54,9 @@ extern bool (*generic_debugscn_p) (const char *) attribute_hidden;
|
||||
dwarf_tag (_die); })
|
||||
|
||||
/* Get a type die corresponding to DIE. Peel CV qualifiers off
|
||||
- it. */
|
||||
+ it. Returns zero if the DIE doesn't have a type, or the type
|
||||
+ is DW_TAG_unspecified_type. Returns -1 on error. Otherwise
|
||||
+ returns the result tag DW_AT value. */
|
||||
static inline int
|
||||
dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
|
||||
{
|
||||
@@ -69,7 +72,14 @@ dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result)
|
||||
if (dwarf_peel_type (result, result) != 0)
|
||||
return -1;
|
||||
|
||||
- return DWARF_TAG_OR_RETURN (result);
|
||||
+ if (result == NULL)
|
||||
+ return -1;
|
||||
+
|
||||
+ int tag = dwarf_tag (result);
|
||||
+ if (tag == DW_TAG_unspecified_type)
|
||||
+ return 0; /* Treat an unspecified type as if there was no type. */
|
||||
+
|
||||
+ return tag;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
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:");
|
||||
--
|
||||
2.43.0
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
From 010cacd89b847659b3c666ac963269b06a8c5058 Mon Sep 17 00:00:00 2001
|
||||
From: Aaron Merey <amerey@redhat.com>
|
||||
Date: Tue, 28 Nov 2023 16:41:35 -0500
|
||||
Subject: [PATCH] tests/run-strip-strmerge.sh: remove ET_REL unstrip and
|
||||
elflint tests
|
||||
|
||||
These tests can fail on i386. Remove them for now since stripping and
|
||||
unstripping an ET_REL file is obscure.
|
||||
|
||||
---
|
||||
tests/run-strip-strmerge.sh | 6 ------
|
||||
1 file changed, 6 deletions(-)
|
||||
|
||||
diff --git a/tests/run-strip-strmerge.sh b/tests/run-strip-strmerge.sh
|
||||
index aa9c1eb..67543eb 100755
|
||||
--- a/tests/run-strip-strmerge.sh
|
||||
+++ b/tests/run-strip-strmerge.sh
|
||||
@@ -69,11 +69,5 @@ echo elflint $stripped
|
||||
testrun ${abs_top_builddir}/src/elflint --gnu $stripped
|
||||
echo elflint $debugfile
|
||||
testrun ${abs_top_builddir}/src/elflint --gnu -d $debugfile
|
||||
-echo unstrip
|
||||
-testrun ${abs_top_builddir}/src/unstrip -o $remerged $stripped $debugfile
|
||||
-echo elflint $remerged
|
||||
-testrun ${abs_top_builddir}/src/elflint --gnu $remerged
|
||||
-echo elfcmp
|
||||
-testrun ${abs_top_builddir}/src/elfcmp $merged $remerged
|
||||
|
||||
exit 0
|
||||
--
|
||||
2.41.0
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Name: elfutils
|
||||
Version: 0.190
|
||||
%global baserelease 3
|
||||
%global baserelease 4
|
||||
Release: %{baserelease}.0.riscv64%{?dist}
|
||||
URL: http://elfutils.org/
|
||||
%global source_url ftp://sourceware.org/pub/elfutils/%{version}/
|
||||
|
@ -77,6 +77,11 @@ BuildRequires: gettext-devel
|
|||
Patch1: elfutils-0.186-fdo-swap.patch
|
||||
# PR30975: Fix handling of corefiles with non-contiguous .so segments.
|
||||
Patch2: elfutils-0.190-fix-core-noncontig.patch
|
||||
# Remove obscure tests that can fail on i386.
|
||||
Patch3: elfutils-0.190-remove-ET_REL-unstrip-test.patch
|
||||
|
||||
# Fix testsuite failure with binutils 2.40 or newer.
|
||||
Patch10: 0001-backends-Handle-DW_TAG_unspecified_type-in-dwarf_pee.patch
|
||||
|
||||
%description
|
||||
Elfutils is a collection of utilities, including stack (to show
|
||||
|
@ -451,9 +456,16 @@ exit 0
|
|||
%systemd_postun_with_restart debuginfod.service
|
||||
|
||||
%changelog
|
||||
* Thu Dec 07 2023 David Abdurachmanov <davidlt@rivosinc.com> - 0.190-4.1.riscv64
|
||||
- Backport f2c522567ad63ac293535fba9704895e685ab5bc
|
||||
- See: https://sourceware.org/bugzilla/show_bug.cgi?id=30047
|
||||
|
||||
* Sat Nov 25 2023 David Abdurachmanov <davidlt@rivosinc.com> - 0.190-3.0.riscv64
|
||||
- Ignore testsuite failures on riscv64
|
||||
|
||||
* Tue Nov 28 2023 Aaron Merey <amerey@fedoraproject.org> - 0.190-4
|
||||
- Add elfutils-0.190-remove-ET_REL-unstrip-test.patch
|
||||
|
||||
* Fri Nov 24 2023 Aaron Merey <amerey@fedoraproject.org> - 0.190-3
|
||||
- Add elfutils-0.190-fix-core-noncontig.patch
|
||||
|
||||
|
|
Loading…
Reference in New Issue