On Mon, Jan 18, 2016 at 07:06:14PM +0100, Jérémy Bobbio wrote: > Hi Mike! > > Mike Hommey: > > When comparing large ELF binaries, some minor differences can end up hurting > > the visibility of more important differences. > > > > Specifically, objdump --disassemble displays symbols+offsets for addresses > > it derives from IP-relative addressing, like the following: > > > > 9d2be2: 48 8d 05 42 65 24 02 lea 0x2246542(%rip),%rax # > > 2c1912b <_fini@@xul45a1+0x1d803> > > I would be grateful if you could try again using the master branch. > Dhole made diffoscope compare ELF sections individually and I wonder how > much it helped with this problem.
I don't think it changed anything. > If it doesn't, would you be so kind to provide example binaries? I can't find the differing binary anymore :( But that can be reproduced with a small testcase: $ cat <<EOF > test.c extern const int qux; int bar() { #ifdef FOO return qux * 2; #else return qux; #endif } EOF $ cat <<EOF > test2.c const int qux = 2; EOF $ gcc -shared -o /tmp/test.so /tmp/test{,2}.c -fPIC $ gcc -shared -o /tmp/test2.so /tmp/test{,2}.c -fPIC -DFOO $ strip test{,2}.so $ diffoscope --text - /tmp/test*.so (...) │ @@ -29,56 +29,57 @@ │ 5a2: 48 89 e5 mov %rsp,%rbp │ 5a5: 48 c1 fe 03 sar $0x3,%rsi │ 5a9: 48 89 f0 mov %rsi,%rax │ 5ac: 48 c1 e8 3f shr $0x3f,%rax │ 5b0: 48 01 c6 add %rax,%rsi │ 5b3: 48 d1 fe sar %rsi │ 5b6: 74 18 je 5d0 <_init@@Base+0xc8> │ - 5b8: 48 8b 05 01 03 20 00 mov 0x200301(%rip),%rax # 2008c0 <qux@@Base+0x200254> │ + 5b8: 48 8b 05 01 03 20 00 mov 0x200301(%rip),%rax # 2008c0 <qux@@Base+0x200250> │ 5bf: 48 85 c0 test %rax,%rax │ 5c2: 74 0c je 5d0 <_init@@Base+0xc8> │ 5c4: 5d pop %rbp │ 5c5: ff e0 jmpq *%rax │ 5c7: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) │ 5ce: 00 00 │ 5d0: 5d pop %rbp │ 5d1: c3 retq │ 5d2: 0f 1f 40 00 nopl 0x0(%rax) │ 5d6: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) │ 5dd: 00 00 00 │ 5e0: 80 3d 09 03 20 00 00 cmpb $0x0,0x200309(%rip) # 2008f0 <_edata@@Base> │ 5e7: 75 27 jne 610 <_init@@Base+0x108> │ - 5e9: 48 83 3d d7 02 20 00 cmpq $0x0,0x2002d7(%rip) # 2008c8 <qux@@Base+0x20025c> │ + 5e9: 48 83 3d d7 02 20 00 cmpq $0x0,0x2002d7(%rip) # 2008c8 <qux@@Base+0x200258> │ 5f0: 00 │ 5f1: 55 push %rbp │ 5f2: 48 89 e5 mov %rsp,%rbp │ 5f5: 74 0c je 603 <_init@@Base+0xfb> │ - 5f7: 48 8b 3d ea 02 20 00 mov 0x2002ea(%rip),%rdi # 2008e8 <qux@@Base+0x20027c> │ + 5f7: 48 8b 3d ea 02 20 00 mov 0x2002ea(%rip),%rdi # 2008e8 <qux@@Base+0x200278> │ 5fe: e8 45 ff ff ff callq 548 <_init@@Base+0x40> │ 603: e8 48 ff ff ff callq 550 <_init@@Base+0x48> │ 608: 5d pop %rbp │ 609: c6 05 e0 02 20 00 01 movb $0x1,0x2002e0(%rip) # 2008f0 <_edata@@Base> │ 610: f3 c3 repz retq │ 612: 0f 1f 40 00 nopl 0x0(%rax) │ 616: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) │ 61d: 00 00 00 │ - 620: 48 8d 3d e1 00 20 00 lea 0x2000e1(%rip),%rdi # 200708 <qux@@Base+0x20009c> │ + 620: 48 8d 3d e1 00 20 00 lea 0x2000e1(%rip),%rdi # 200708 <qux@@Base+0x200098> │ 627: 48 83 3f 00 cmpq $0x0,(%rdi) │ 62b: 75 0b jne 638 <_init@@Base+0x130> │ 62d: e9 5e ff ff ff jmpq 590 <_init@@Base+0x88> │ 632: 66 0f 1f 44 00 00 nopw 0x0(%rax,%rax,1) │ - 638: 48 8b 05 79 02 20 00 mov 0x200279(%rip),%rax # 2008b8 <qux@@Base+0x20024c> │ + 638: 48 8b 05 79 02 20 00 mov 0x200279(%rip),%rax # 2008b8 <qux@@Base+0x200248> │ 63f: 48 85 c0 test %rax,%rax │ 642: 74 e9 je 62d <_init@@Base+0x125> │ 644: 55 push %rbp │ 645: 48 89 e5 mov %rsp,%rbp │ 648: ff d0 callq *%rax │ 64a: 5d pop %rbp │ 64b: e9 40 ff ff ff jmpq 590 <_init@@Base+0x88> │ │ 0000000000000650 <bar@@Base>: │ 650: 55 push %rbp │ 651: 48 89 e5 mov %rsp,%rbp │ - 654: 48 8b 05 4d 02 20 00 mov 0x20024d(%rip),%rax # 2008a8 <qux@@Base+0x20023c> │ + 654: 48 8b 05 4d 02 20 00 mov 0x20024d(%rip),%rax # 2008a8 <qux@@Base+0x200238> │ 65b: 8b 00 mov (%rax),%eax │ - 65d: 5d pop %rbp │ - 65e: c3 retq │ + 65d: 01 c0 add %eax,%eax │ + 65f: 5d pop %rbp │ + 660: c3 retq ╵ Mike