diff options
author | Khem Raj <raj.khem@gmail.com> | 2023-02-14 08:34:04 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-02-17 18:01:01 +0000 |
commit | 6807f364470b63370524d1966a8973ad56f163ee (patch) | |
tree | 5f7f9bc8ab72c1f5da853986de4172fffc442b73 /meta/recipes-devtools/elfutils | |
parent | abf2776641cf1f58824e166d04c0d77f485f963c (diff) | |
download | poky-6807f364470b63370524d1966a8973ad56f163ee.tar.gz |
elfutils: Backport fix for DW_TAG_unspecified_type handling
Re-enable funcretval tests
(From OE-Core rev: af1f63182fc5a4dd74678fa86815b8ad45f58fc5)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-devtools/elfutils')
-rw-r--r-- | meta/recipes-devtools/elfutils/elfutils_0.188.bb | 3 | ||||
-rw-r--r-- | meta/recipes-devtools/elfutils/files/handle_DW_TAG_unspecified_type.patch | 88 |
2 files changed, 89 insertions, 2 deletions
diff --git a/meta/recipes-devtools/elfutils/elfutils_0.188.bb b/meta/recipes-devtools/elfutils/elfutils_0.188.bb index 182229becf..74271b2411 100644 --- a/meta/recipes-devtools/elfutils/elfutils_0.188.bb +++ b/meta/recipes-devtools/elfutils/elfutils_0.188.bb | |||
@@ -23,6 +23,7 @@ SRC_URI = "https://sourceware.org/elfutils/ftp/${PV}/${BP}.tar.bz2 \ | |||
23 | file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \ | 23 | file://0001-tests-Makefile.am-compile-test_nlist-with-standard-C.patch \ |
24 | file://0001-PR29926-debuginfod-Fix-usage-of-deprecated-CURLINFO_.patch \ | 24 | file://0001-PR29926-debuginfod-Fix-usage-of-deprecated-CURLINFO_.patch \ |
25 | file://0002-debuginfod-client-Use-CURLOPT_PROTOCOLS_STR-for-libc.patch \ | 25 | file://0002-debuginfod-client-Use-CURLOPT_PROTOCOLS_STR-for-libc.patch \ |
26 | file://handle_DW_TAG_unspecified_type.patch \ | ||
26 | " | 27 | " |
27 | SRC_URI:append:libc-musl = " \ | 28 | SRC_URI:append:libc-musl = " \ |
28 | file://0003-musl-utils.patch \ | 29 | file://0003-musl-utils.patch \ |
@@ -98,8 +99,6 @@ do_install_ptest() { | |||
98 | cp -r ${B}/debuginfod ${D}${PTEST_PATH} | 99 | cp -r ${B}/debuginfod ${D}${PTEST_PATH} |
99 | sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile | 100 | sed -i '/^Makefile:/c Makefile:' ${D}${PTEST_PATH}/tests/Makefile |
100 | find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {} | 101 | find ${D}${PTEST_PATH} -type f -name *.[hoc] | xargs -i rm {} |
101 | # TODO: remove below filter after https://sourceware.org/bugzilla/show_bug.cgi?id=30047 is fixed | ||
102 | sed -i -e '/funcretval/d' ${D}${PTEST_PATH}/tests/run-native-test.sh | ||
103 | fi | 102 | fi |
104 | } | 103 | } |
105 | 104 | ||
diff --git a/meta/recipes-devtools/elfutils/files/handle_DW_TAG_unspecified_type.patch b/meta/recipes-devtools/elfutils/files/handle_DW_TAG_unspecified_type.patch new file mode 100644 index 0000000000..8cab01c29a --- /dev/null +++ b/meta/recipes-devtools/elfutils/files/handle_DW_TAG_unspecified_type.patch | |||
@@ -0,0 +1,88 @@ | |||
1 | From: Mark Wielaard <mark@klomp.org> | ||
2 | Date: Thu, 26 Jan 2023 17:19:15 +0000 (+0100) | ||
3 | Subject: backends: Handle DW_TAG_unspecified_type in dwarf_peeled_die_type | ||
4 | X-Git-Url: https://sourceware.org/git/?p=elfutils.git;a=commitdiff_plain;h=f2c522567ad63ac293535fba9704895e685ab5bc;hp=3fa98a6f29b0f370e32549ead7eb897c839af980 | ||
5 | |||
6 | backends: Handle DW_TAG_unspecified_type in dwarf_peeled_die_type | ||
7 | |||
8 | binutils 2.40 introduces DW_TAG_unspecified_type for assembly | ||
9 | functions with an unknown return type. This breaks the | ||
10 | run-funcretval.sh testcase because dwfl_module_return_value_location | ||
11 | returns an error for such functions because it cannot determine the | ||
12 | return value location. Fix that by treating DW_TAG_unspecified_type | ||
13 | as if the DIE doesn't have a DW_AT_type. | ||
14 | |||
15 | Also update the testcase to explicitly checking for | ||
16 | DW_TAG_unspecified_type and printing "returns unspecified type". | ||
17 | |||
18 | https://sourceware.org/bugzilla/show_bug.cgi?id=30047 | ||
19 | |||
20 | Upstream-Status: Backport [https://sourceware.org/git/?p=elfutils.git;a=commitdiff;h=f2c522567ad63ac293535fba9704895e685ab5bc;hp=3fa98a6f29b0f370e32549ead7eb897c839af980] | ||
21 | Signed-off-by: Mark Wielaard <mark@klomp.org> | ||
22 | --- | ||
23 | |||
24 | --- a/backends/libebl_CPU.h | ||
25 | +++ b/backends/libebl_CPU.h | ||
26 | @@ -1,5 +1,6 @@ | ||
27 | /* Common interface for libebl modules. | ||
28 | Copyright (C) 2000, 2001, 2002, 2003, 2005, 2013, 2014 Red Hat, Inc. | ||
29 | + Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org> | ||
30 | This file is part of elfutils. | ||
31 | |||
32 | This file is free software; you can redistribute it and/or modify | ||
33 | @@ -53,7 +54,9 @@ extern bool (*generic_debugscn_p) (const | ||
34 | dwarf_tag (_die); }) | ||
35 | |||
36 | /* Get a type die corresponding to DIE. Peel CV qualifiers off | ||
37 | - it. */ | ||
38 | + it. Returns zero if the DIE doesn't have a type, or the type | ||
39 | + is DW_TAG_unspecified_type. Returns -1 on error. Otherwise | ||
40 | + returns the result tag DW_AT value. */ | ||
41 | static inline int | ||
42 | dwarf_peeled_die_type (Dwarf_Die *die, Dwarf_Die *result) | ||
43 | { | ||
44 | @@ -69,7 +72,14 @@ dwarf_peeled_die_type (Dwarf_Die *die, D | ||
45 | if (dwarf_peel_type (result, result) != 0) | ||
46 | return -1; | ||
47 | |||
48 | - return DWARF_TAG_OR_RETURN (result); | ||
49 | + if (result == NULL) | ||
50 | + return -1; | ||
51 | + | ||
52 | + int tag = dwarf_tag (result); | ||
53 | + if (tag == DW_TAG_unspecified_type) | ||
54 | + return 0; /* Treat an unspecified type as if there was no type. */ | ||
55 | + | ||
56 | + return tag; | ||
57 | } | ||
58 | |||
59 | #endif /* libebl_CPU.h */ | ||
60 | --- a/tests/funcretval.c | ||
61 | +++ b/tests/funcretval.c | ||
62 | @@ -1,5 +1,6 @@ | ||
63 | /* Test program for dwfl_module_return_value_location. | ||
64 | Copyright (C) 2005 Red Hat, Inc. | ||
65 | + Copyright (C) 2023 Mark J. Wielaard <mark@klomp.org> | ||
66 | This file is part of elfutils. | ||
67 | |||
68 | This file is free software; you can redistribute it and/or modify | ||
69 | @@ -67,7 +68,18 @@ handle_function (Dwarf_Die *funcdie, voi | ||
70 | error (EXIT_FAILURE, 0, "dwfl_module_return_value_location: %s", | ||
71 | dwfl_errmsg (-1)); | ||
72 | else if (nlocops == 0) | ||
73 | - puts ("returns no value"); | ||
74 | + { | ||
75 | + // Check if this is the special unspecified type | ||
76 | + // https://sourceware.org/bugzilla/show_bug.cgi?id=30047 | ||
77 | + Dwarf_Die die_mem, *typedie = &die_mem; | ||
78 | + Dwarf_Attribute attr_mem, *attr; | ||
79 | + attr = dwarf_attr_integrate (funcdie, DW_AT_type, &attr_mem); | ||
80 | + if (dwarf_formref_die (attr, typedie) != NULL | ||
81 | + && dwarf_tag (typedie) == DW_TAG_unspecified_type) | ||
82 | + puts ("returns unspecified type"); | ||
83 | + else | ||
84 | + puts ("returns no value"); | ||
85 | + } | ||
86 | else | ||
87 | { | ||
88 | printf ("return value location:"); | ||