ELF file diffs doesnt handle offets well
A single bigger ELF section will move down everything, other sections are binary identical but you will get alot diffs that contain absolute PC or file-offsets. At least:
- hexdumps will have file offsets
- disassembly (relative/relocated jumps in the binary will be decorated with absolute addresses)
Some small example (diff is way bigger, multiple huge hexdumps of identical binary sections):
## readelf --wide --file-header {}
```diff
@@ -4,15 +4,15 @@
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: DYN (Shared object file)
Machine: Advanced Micro Devices X86-64
Version: 0x1
- Entry point address: 0x400
+ Entry point address: 0x3a0
Start of program headers: 64 (bytes into file)
Start of section headers: 4312 (bytes into file)
Flags: 0x0
Size of this header: 64 (bytes)
Size of program headers: 56 (bytes)
Number of program headers: 9
Size of section headers: 64 (bytes)
```
## readelf --wide --decompress --hex-dump=.rodata {}
```diff
@@ -1,5 +1,5 @@
Hex dump of section '.rodata':
- 0x000004c0 ffffff7f 00000000 00000000 00000000 ................
- 0x000004d0 ffff7f7f 00000000 ........
+ 0x00000460 ffffff7f 00000000 00000000 00000000 ................
+ 0x00000470 ffff7f7f 00000000 ........
```
I would propose that you compare elf sections on identical size, then binary and only if one of those tests file, use further introspection. There are other issues open to improve output in general (ie. if a 10MB section differs in a single byte, but has different file offset you would get a huge diff aswell), one idea would be to use offsets relative to the dumped section, but that would include modifying the used tools or their output.