dwz 0.13 fails devel-ignore-size.sh test. I try to reproduce test result manually: builder@i586:~/RPM/BUILD/dwz-0.13$ make min cc /usr/src/RPM/BUILD/dwz-0.13/testsuite/dwz.tests/min.c /usr/src/RPM/BUILD/dwz-0.13/testsuite/dwz.tests/min-2.c -o min -g builder@i586:~/RPM/BUILD/dwz-0.13$ cp min 1 builder@i586:~/RPM/BUILD/dwz-0.13$ readelf -wi 1 | grep '(DW_TAG_partial_unit' builder@i586:~/RPM/BUILD/dwz-0.13$ ./dwz-for-test 1 builder@i586:~/RPM/BUILD/dwz-0.13$ readelf -wi 1 | grep '(DW_TAG_partial_unit' <0><b>: Abbrev Number: 44 (DW_TAG_partial_unit) <5d> DW_AT_import : <0xb> [Abbrev Number: 44 (DW_TAG_partial_unit)] <4aa> DW_AT_import : <0xb> [Abbrev Number: 44 (DW_TAG_partial_unit)] Test seems to expect all matches by be 0 always.
To add, this is readelf from binutils 2.35.1.
It looks like binutils 2.35.1 readelf helpfully adds the tag (DW_TAG_partial_unit in this case) to the DW_AT_import when reporting the Abbrev Number. Older readelf produced: <0><b>: Abbrev Number: 17 (DW_TAG_partial_unit) <6b> DW_AT_import : <0xb> [Abbrev Number: 17] <da> DW_AT_import : <0xb> [Abbrev Number: 17] So an workaround might be something like: diff --git a/testsuite/dwz.tests/pr24468.sh b/testsuite/dwz.tests/pr24468.sh index 4dac9a1..3b1b671 100644 --- a/testsuite/dwz.tests/pr24468.sh +++ b/testsuite/dwz.tests/pr24468.sh @@ -7,7 +7,7 @@ dwz -m 3 1 2 readelf -wi 1 > READELF 2>/dev/null -offsets=$(grep '(DW_TAG_partial_unit' READELF \ +offsets=$(grep '(DW_TAG_partial_unit' READELF | grep -v DW_AT_import \ | awk '{print $1}' \ | sed 's/.*<//;s/>.*//') for off in $offsets; do
Mark, Yes, this strips additional DW_AT_import lines, but test still fail. builder@x86_64:~/RPM/BUILD/dwz-0.13$ \cp min 1 builder@x86_64:~/RPM/BUILD/dwz-0.13$ readelf -wi 1 | grep '(DW_TAG_partial_unit' builder@x86_64:~/RPM/BUILD/dwz-0.13$ ./dwz-for-test 1 builder@x86_64:~/RPM/BUILD/dwz-0.13$ readelf -wi 1 | grep '(DW_TAG_partial_unit' | grep -v DW_AT_import <0><b>: Abbrev Number: 43 (DW_TAG_partial_unit) builder@x86_64:~/RPM/BUILD/dwz-0.13$ cat /usr/src/RPM/BUILD/dwz-0.13/testsuite/dwz.tests/devel-ignore-size.sh ... [ $cnt -eq 0 ] ... builder@x86_64:~/RPM/BUILD/dwz-0.13$ ls -la min 1 -rwxr-xr-x 1 builder builder 26104 Jan 2 12:58 1 -rwxr-xr-x 1 builder builder 26616 Jan 2 12:55 min I think dwz modifies test binary even though it's expected to not(?).
After more investigating, I think it maybe related to glibc update from 2.30 to 2.32. (Time correlation w/o proof yet.)
Can you attach the binary, before and after dwz-ing?
Created attachment 13088 [details] example of dwz in/out binaries Attached archive with `min` is source, `1` is processed.
(In reply to Vitaly Chikunov from comment #6) > Created attachment 13088 [details] > example of dwz in/out binaries > > Attached archive with `min` is source, `1` is processed. Comparing the size results, that looks sane: ... $ ../../../measure/diff.sh min 1 .debug_info red: 19.24% 1986 1604 .debug_abbrev red: 16.19% 791 663 .debug_str red: 0% 1726 1726 total red: 11.33% 4503 3993 ... Looking at the created partial unit, it contains a couple of base types, like "long unsigned int". Using a grep, we can see that this comes from compilation units abi-note.c and elf-init.c: ... $ egrep "DW_AT_name.*(long unsigned int|\.)|Compilation" READELF.min | grep -v "long long" Compilation Unit @ offset 0x0: <20> DW_AT_name : ../sysdeps/x86_64/start.S Compilation Unit @ offset 0x2e: <3f> DW_AT_name : abi-note.c <63> DW_AT_name : long unsigned int Compilation Unit @ offset 0x4ff: <510> DW_AT_name : init.c Compilation Unit @ offset 0x53f: <553> DW_AT_name : ../sysdeps/x86_64/crti.S Compilation Unit @ offset 0x561: <572> DW_AT_name : min.c Compilation Unit @ offset 0x5b4: <5c5> DW_AT_name : min-2.c Compilation Unit @ offset 0x607: <618> DW_AT_name : elf-init.c <64f> DW_AT_name : long unsigned int Compilation Unit @ offset 0x7a0: <7b4> DW_AT_name : ../sysdeps/x86_64/crtn.S ... So this all seems ok. Without reverting to dwarf assembly, it's hard to create an exec with debug info that is guaranteed to not be compressed. So for now, the easiest fix is to detect this situation, and mark the test unsupported: ... diff --git a/testsuite/dwz.tests/devel-ignore-size.sh b/testsuite/dwz.tests/devel-ignore-si ze.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 ...
https://sourceware.org/git/?p=dwz.git;a=commit;h=282322d59df6cbf3b0af572077d93d5b5b882b41 [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 <tdevries@suse.de> PR dwz/27115 * testsuite/dwz.tests/devel-ignore-size.sh: If exec is transformed without --devel-ignore-size, mark unsupported.
Tom, thanks for solving this!