From fe44ecf795f188261e2b6e27eb5cc334944f5bd2a9c1dbf41580b4035eb5dff7 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Tue, 12 Jan 2021 08:40:04 +0000 Subject: [PATCH] Accepting request 861040 from home:tomdevries:branches:devel:tools:compiler-dwz-fix-testcases - Fix pr24468.sh test-case with newer readelf. * dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch * dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch - Detect when devel-ignore-size.sh is unsupported [swo#27115]. * dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch OBS-URL: https://build.opensuse.org/request/show/861040 OBS-URL: https://build.opensuse.org/package/show/devel:tools:compiler/dwz?expand=0&rev=32 --- ...t-case-for-readelf-with-follow-links.patch | 29 +++++++++++ ...-devel-ignore-size-sh-is-unsupported.patch | 39 +++++++++++++++ ...-partial-unit-grepping-in-pr24468-sh.patch | 50 +++++++++++++++++++ dwz.changes | 13 +++++ dwz.spec | 8 ++- 5 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch create mode 100644 dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch create mode 100644 dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch diff --git a/dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch b/dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch new file mode 100644 index 0000000..54ebfde --- /dev/null +++ b/dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch @@ -0,0 +1,29 @@ +Adjust pr24468.sh test-case for readelf with =follow-links. + +Newer binutils readelf have =follow-links which is automatically +enabled with -w. This shows not only the debuginfo of the main file +but also that of the alt file referenced. This causes the pr24468.sh +to see "too many" DW_TAG_partial_units (from both files) which then +doesn't matches the number of DW_AT_imports. The fix is simply to +use -wi instead of -w since we are only interested in the .debug_info +DIEs anyway. + + * testsuite/dwz.tests/pr24468.sh: Use readelf -wi. + +--- + testsuite/dwz.tests/pr24468.sh | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/testsuite/dwz.tests/pr24468.sh b/testsuite/dwz.tests/pr24468.sh +index b03fdf9..4dac9a1 100644 +--- a/testsuite/dwz.tests/pr24468.sh ++++ b/testsuite/dwz.tests/pr24468.sh +@@ -5,7 +5,7 @@ cp 1 2 + + dwz -m 3 1 2 + +-readelf -w 1 > READELF 2>/dev/null ++readelf -wi 1 > READELF 2>/dev/null + + offsets=$(grep '(DW_TAG_partial_unit' READELF \ + | awk '{print $1}' \ diff --git a/dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch b/dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch new file mode 100644 index 0000000..660527d --- /dev/null +++ b/dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch @@ -0,0 +1,39 @@ +[testsuite] Detect when devel-ignore-size.sh is unsupported + +In PR27115, a failure of devel-ignore-size.sh is reported. + +The test-case: +- tries to transform an executable +- checks that it didn't transform +- retries using --devel-ignore-size +- check that it did transform + +The reported failure is in the second step. + +Fix this by marking the test unsupported if the second step fails. + +2021-01-04 Tom de Vries + + PR dwz/27115 + * testsuite/dwz.tests/devel-ignore-size.sh: If exec is transformed + without --devel-ignore-size, mark unsupported. + +--- + testsuite/dwz.tests/devel-ignore-size.sh | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/testsuite/dwz.tests/devel-ignore-size.sh b/testsuite/dwz.tests/devel-ignore-size.sh +index 5134043..78d28a2 100644 +--- a/testsuite/dwz.tests/devel-ignore-size.sh ++++ b/testsuite/dwz.tests/devel-ignore-size.sh +@@ -12,7 +12,9 @@ cnt=$(readelf -wi 1 \ + | grep '(DW_TAG_partial_unit' \ + | wc -l) + +-[ $cnt -eq 0 ] ++if [ $cnt -ne 0 ]; then ++ exit 77 ++fi + + cp $execs/min 1 + diff --git a/dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch b/dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch new file mode 100644 index 0000000..6f1407f --- /dev/null +++ b/dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch @@ -0,0 +1,50 @@ +[testsuite] Fix partial unit grepping in pr24468.sh + +I'm running into: +... +FAIL: src/testsuite/dwz.tests/pr24468.sh +... + +In more detail, we find the following offsets for partial units: +... ++ offsets='b +6b +da' +... +and then fail to find an import for the one at 6b: +... +++ grep -c 'DW_AT_import.*0x6b' READELF +++ true ++ imports=0 ++ '[' 0 -gt 0 ']' +... + +But there's actually no partial unit at 6b, the grep matches on a +DW_AT_import: +... + <6b> DW_AT_import : <0xb> [Abbrev Number: 17 (DW_TAG_partial_unit)] +... + +Fix this by filtering out the DW_AT_import lines when grepping for partial +units. + +2020-12-20 Tom de Vries + + * testsuite/dwz.tests/pr24468.sh: Fix partial unit grepping. + +--- + testsuite/dwz.tests/pr24468.sh | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/testsuite/dwz.tests/pr24468.sh b/testsuite/dwz.tests/pr24468.sh +index 4dac9a1..7990e83 100644 +--- a/testsuite/dwz.tests/pr24468.sh ++++ b/testsuite/dwz.tests/pr24468.sh +@@ -8,6 +8,7 @@ dwz -m 3 1 2 + readelf -wi 1 > READELF 2>/dev/null + + offsets=$(grep '(DW_TAG_partial_unit' READELF \ ++ | grep -v "DW_AT_import" \ + | awk '{print $1}' \ + | sed 's/.*.*//') + for off in $offsets; do diff --git a/dwz.changes b/dwz.changes index f6bb415..459b3d3 100644 --- a/dwz.changes +++ b/dwz.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Thu Jan 7 10:21:31 UTC 2021 - Tom de Vries + +- Fix pr24468.sh test-case with newer readelf. + * dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch + * dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch + +------------------------------------------------------------------- +Thu Jan 7 09:15:48 UTC 2021 - Tom de Vries + +- Detect when devel-ignore-size.sh is unsupported [swo#27115]. + * dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch + ------------------------------------------------------------------- Wed Aug 5 08:16:04 UTC 2020 - Tom de Vries diff --git a/dwz.spec b/dwz.spec index f51512b..90c50c1 100644 --- a/dwz.spec +++ b/dwz.spec @@ -1,7 +1,7 @@ # # spec file for package dwz # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -85,6 +85,9 @@ Patch3: dwz-fix-assertion-off-cu_size-in-recompute_abbrevs.patch Patch4: dwz-fix-refd-NULL-assertion-in-write_die.patch Patch5: dwz-fix-reference-from-pu-to-cu.patch Patch6: dwz-fix-segfault-in-die_cu.patch +Patch7: dwz-testsuite-detect-when-devel-ignore-size-sh-is-unsupported.patch +Patch8: dwz-testsuite-adjust-pr24468-sh-test-case-for-readelf-with-follow-links.patch +Patch9: dwz-testsuite-fix-partial-unit-grepping-in-pr24468-sh.patch %if %{build_main} %description @@ -119,6 +122,9 @@ This package contains the testsuite results from DWZ. %patch4 -p1 %patch5 -p1 %patch6 -p1 +%patch7 -p1 +%patch8 -p1 +%patch9 -p1 %build make %{?_smp_mflags} CFLAGS="%{optflags}"