From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24509 invoked by alias); 20 Dec 2017 01:15:39 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 24343 invoked by uid 89); 20 Dec 2017 01:15:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: =?ISO-8859-1?Q?No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=sk:philipp, shouldn, won=e2, won?= X-HELO: mail.redfish-solutions.com Received: from mail.redfish-solutions.com (HELO mail.redfish-solutions.com) (66.232.79.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Dec 2017 01:15:25 +0000 Received: from macmini.redfish-solutions.com ([192.168.1.38]) (authenticated bits=0) by mail.redfish-solutions.com (8.15.2/8.15.2) with ESMTPSA id vBK1FIRG002337 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 19 Dec 2017 18:15:19 -0700 From: Philip Prindeville Message-Id: Content-Type: multipart/mixed; boundary="Apple-Mail=_48BAE032-479B-4915-B469-CAE63A895BED" Mime-Version: 1.0 (Mac OS X Mail 11.1 \(3445.4.7\)) Subject: Re: Comparing binaries automatically Date: Wed, 20 Dec 2017 01:15:00 -0000 In-Reply-To: <01D91EFE-2DCE-4E48-A22F-B876E2AD3C35@redfish-solutions.com> Cc: binutils@sourceware.org To: Simon Richter References: <47a1952a-2d81-bd3c-f5ce-13e49cbea0cc@hogyros.de> <01D91EFE-2DCE-4E48-A22F-B876E2AD3C35@redfish-solutions.com> X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00164.txt.bz2 --Apple-Mail=_48BAE032-479B-4915-B469-CAE63A895BED Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 Content-length: 2765 > On Dec 19, 2017, at 12:09 PM, Philip Prindeville wrote: >=20 >=20 >=20 >> On Dec 19, 2017, at 6:06 AM, Simon Richter wr= ote: >>=20 >> Hi, >>=20 >> On 19.12.2017 05:48, Philip Prindeville wrote: >>=20 >>> Anyone know of a way to do a =E2=80=9Csmart=E2=80=9D comparison of exec= utables (or relocatable objections, or shared libraries, or=E2=80=A6)? >>=20 >> The Debian Reproducible Builds project has a tool called "diffoscope", >> as well as a few years experience reproducing compilation results, so >> this may be a good starting point: >>=20 >> https://wiki.debian.org/ReproducibleBuilds >>=20 >> They don't have a good solution for __DATE__ yet though, unless you >> consider a compiler flag warning about its use a solution. >>=20 >> Simon >>=20 >=20 >=20 > Yeah, I=E2=80=99ve seen a variety of approaches to the __DATE__/__TIME__/= __TIMESTEMP__ problem, including setting SOURCE_DATE_EPOCH to the mtime of = the youngest file in the tarball or the timestamp of the most recent git co= mmit, etc. (although squashing/rebasing commits tends to screw up their tim= estamp in that the code might be changed/updated but the timestamp remains = that of the original commit not the rebased once). >=20 > No perfect solution. >=20 > Will have a look at diffoscope, thanks. >=20 >=20 > -Philip >=20 Hi all, I tried doing the following: #define __Variant __attribute__((section(=E2=80=9C.variant=E2=80=9D))) =E2=80=A6 const char __revision[] __Variant =3D REVISION; /* defined by CPPFLAGS on = command-line */ and then substituting out occurrences (there was just one) of REVISION for = __revision, and recompiling. The tried the following steps: % mips-openwrt-linux-uclibc-objcopy -R .variant dnssec_test dnssec_test.str= ipped % mips-openwrt-linux-uclibc-objdump -D dnssec_test > dnssec_test.lst % mips-openwrt-linux-uclibc-objdump -D dnssec_test.stripped > dnssec_test.s= tripped.lst % diff -u dnssec_test.lst dnssec_test.stripped.lstt > dnssec_test.diff The result is attached. The differences in the filenames I expected. The missing .variant section = was of course the desired effect. But what I don=E2=80=99t get is why the symbol names for the subsequent add= resses (00414010, 0041443c, 00414440, 004144f0, and 0000000) ended up disag= reeing. In the future, when comparing two different compiles, I=E2=80=99ll be delet= ing the .variant section from both of them, so the offsets should be affect= ed similarly, and there won=E2=80=99t be disagreement. But here on the same file before and after deletion, there was. It shouldn= =E2=80=99t be a problem but it is curious and I=E2=80=99d like to understan= d it and if possible, find a workaround. Thanks, -Philip --Apple-Mail=_48BAE032-479B-4915-B469-CAE63A895BED Content-Disposition: attachment; filename=dnssec_test.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="dnssec_test.diff" Content-Transfer-Encoding: 7bit Content-length: 1583 --- dnssec_test.lst 2017-12-19 23:23:10.041489211 +0000 +++ dnssec_test.stripped.lst 2017-12-19 23:23:12.973515877 +0000 @@ -1,5 +1,5 @@ -dnssec_test: file format elf32-tradbigmips +dnssec_test.stripped: file format elf32-tradbigmips Disassembly of section .interp: @@ -4686,18 +4686,6 @@ 403ae0: 00403690 0x403690 403ae4: 0040369c 0x40369c -Disassembly of section .variant: - -00403ae8 <.variant>: - 403ae8: 616e6472 0x616e6472 - 403aec: 6f69642d 0x6f69642d - 403af0: 32303137 andi s0,s1,0x3137 - 403af4: 2d30392d sltiu s0,t1,14637 - 403af8: 7263322d 0x7263322d - 403afc: 372d6763 ori t5,t9,0x6763 - 403b00: 64313538 0x64313538 - 403b04: 36350000 ori s5,s1,0x0 - Disassembly of section .eh_frame: 00403b08 <.eh_frame>: @@ -4717,7 +4705,7 @@ Disassembly of section .data: -00414010 <_fdata>: +00414010 <.data>: 414010: 59000000 blezl t0,414014 <_fdata+0x4> 414014: 46000000 add.s $f0,$f0,$f0 414018: 46000000 add.s $f0,$f0,$f0 @@ -4732,12 +4720,12 @@ Disassembly of section .rld_map: -0041443c <__RLD_MAP>: +0041443c <_fdata+0x42c>: 41443c: 00000000 nop Disassembly of section .got.plt: -00414440 <.got.plt>: +00414440 <__RLD_MAP+0x4>: ... 414448: 00400a20 0x400a20 41444c: 00400a20 0x400a20 @@ -4784,12 +4772,12 @@ Disassembly of section .bss: -004144f0 : +004144f0 <.bss>: ... Disassembly of section .comment: -00000000 <.comment>: +00000000 : 0: 4743433a c1 0x143433a 4: 2028474e addi t0,at,18254 8: 55292033 bnel t1,t1,80d8 <_init-0x3f88e8> --Apple-Mail=_48BAE032-479B-4915-B469-CAE63A895BED--