Catch failures to disassemble and rescue all other differences. (!29)
When trying and failing to disassemble an ELF library from an architecture not supported by objdump, catch that particular failure and don't let it revert the *entire* diff to hexdump, throwing the entire kindergarten class with the bathwater. Fallback on hexdump _only_ for the problematic text section and rescue all the rest. Example: Before: diffoscope build?/app/libapp.a --- build1/app/libapp.a +++ build2/app/libapp.a │┄ Command `objdump --line-numbers --disassemble --demangle --reloc │┄ --section=.text build1/app/libapp.a` exited with return code 1. Output: │┄ objdump: can't disassemble for architecture UNKNOWN! │┄ │┄ objdump: section '.text' mentioned in a -j option, but not found │┄ in any input file │┄ @@ -1,22 +1,22 @@ 00000000: 213c 6172 6368 3e0a 2f20 2020 2020 2020 !<arch>./ 00000010: 2020 2020 2020 2020 3135 3633 3333 3638 15633368 -00000020: 3830 2020 3020 2020 2020 3020 2020 2020 80 0 0 +00000020: 3931 2020 3020 2020 2020 3020 2020 2020 91 0 0 00000030: 3020 2020 2020 2020 3134 2020 2020 2020 0 14 00000040: 2020 600a 0000 0001 0000 0052 6d61 696e `........Rmain 00000050: 0000 6d61 696e 2e63 2e6f 626a 2f20 2020 ..main.c.obj/ 00000060: 2020 3020 2020 2020 2020 2020 2020 3020 0 0 00000070: 2020 2020 3020 2020 2020 3634 3420 2020 0 644 00000080: 2020 3130 3332 2020 2020 2020 600a 7f45 1032 `..E 00000090: 4c46 0101 0100 0000 0000 0000 0000 0100 LF.............. 000000a0: 2800 0100 0000 0000 0000 0000 0000 2802 (.............(. 000000b0: 0000 0000 0005 3400 0000 0000 2800 0c00 ......4.....(... 000000c0: 0b00 0149 0248 fff7 febf 0000 0000 0b00 ...I.H.......... 000000d0: 0000 6d70 7332 5f61 6e33 3835 0048 656c ..mps2_an385.Hel -000000e0: 6c6f 2057 6f72 6c64 2120 2573 0a00 0047 lo World! %s...G +000000e0: 6c6f 2058 6f72 6c64 2120 2573 0a00 0047 lo Xorld! %s...G 000000f0: 4343 3a20 2863 726f 7373 746f 6f6c 2d4e CC: (crosstool-N 00000100: 4720 312e 3234 2e30 2d72 6332 2d64 6972 G 1.24.0-rc2-dir 00000110: 7479 2920 382e 332e 3000 412c 0000 0061 ty) 8.3.0.A,...a 00000120: 6561 6269 0001 2200 0000 0537 2d4d 0006 eabi.."....7-M.. 00000130: 0a07 4d09 0212 0414 0115 0117 0318 0119 ..M............. 00000140: 011a 011e 0422 0100 0000 0000 0000 0000 .....".......... 00000150: 0000 0000 0000 0000 0000 0100 0000 0000 ................ - After: 2019-07-17 04:15:40 E: diffoscope.comparators.elf: Command '['objdump', '--line-numbers', '--disassemble', '--demangle', '--reloc', '--section=.text.main', 'build1/app/libapp.a']' returned non-zero exit status 1. 2019-07-17 04:15:40 E: diffoscope.comparators.elf: Command '['objdump', '--disassemble', '--demangle', '--section=.text.main', 'build1/app/libapp.a']' returned non-zero exit status 1. --- build1/app/libapp.a +++ build2/app/libapp.a ├── file list │ @@ -1,2 +1,2 @@ │ ----------- 0 0 0 14 2019-07-17 04:14:40.000000 / │ +---------- 0 0 0 14 2019-07-17 04:14:51.000000 / │ ?rw-r--r-- 0 0 0 1032 1970-01-01 00:00:00.000000 main.c.obj ├── readelf --wide --decompress --string-dump=.rodata.main.str1.1 {} │ @@ -1,7 +1,7 @@ │ │ File: lib.a(main.c.obj) │ │ String dump of section '.rodata.main.str1.1': │ [ 0] mps2_an385 │ - [ b] Hello World! %s^J │ + [ b] Hello Xorld! %s^J Signed-off-by: Marc Herbert <marc.herbert@gmail.com> Signed-off-by: Chris Lamb <lamby@debian.org>
parent
f2c87dfc
Loading
Loading
Pipeline
#56274
passed with warnings
with stage
in
15 minutes and 47 seconds
Loading
-
👀 @lambymentioned in merge request !29 (closed)
-
mentioned in commit d3c7ac8e
Please register or sign in to comment