Bug#838260: diffoscope: Reduce noise from offsets deltas in readelf(1) diffs

Helmut Grohne helmut at subdivi.de
Sat Sep 16 09:02:44 UTC 2017


On Thu, Sep 22, 2016 at 01:46:17PM +0000, Daniel Shahaf wrote:
> Control: retitle -2 diffoscope: readelf(1): Ignore data/instruction addresses that are de facto line numbers

> flexc++ has a difference on *every* line of several sections (.rodata,
> .eh_frame, others) because the sections start 0xc0 bytes later in the
> second build than in the first build:
> 
> ???   ???   ???   ???   ??? -  0x0043a320 01000200 00000000 623a423a 633a433a ........b:B:c:C:
> ???   ???   ???   ???   ??? -  0x0043a330 64663a46 68693a49 3a4b6c3a 4c3a6d3a df:Fhi:I:Kl:L:m:
> ???
> ???   ???   ???   ???   ??? +  0x0043a3e0 01000200 00000000 623a423a 633a433a ........b:B:c:C:
> ???   ???   ???   ???   ??? +  0x0043a3f0 64663a46 68693a49 3a4b6c3a 4c3a6d3a df:Fhi:I:Kl:L:m:
> 
> Hence, filing this as a separate issue.  #838260 can remain about
> offsets embedded in instructions.

Let me chime in here.

Some of you know that I am working on cross building Debian and that
work has been evolving sufficiently well that comparing cross builds
against native builds becomes feasible (thanks to the reproducible
work). Essentially, what I want is reproducible builds with varying
build architecture.

A common issue with this work is that the number of ELF sections varies
between cross and native builds. Thus offsets differ and that makes the
diffoscope output too noisy to be useful.

Mattia asked me to include an example:

| objdump --line-numbers --disassemble --demangle --section=.init {}
| @@ -1,11 +1,11 @@
|
|
|
|  Disassembly of section .init:
|
| -0000000000003778 <_init@@Base>:
| -    3778:      a9bf7bfd        stp     x29, x30, [sp, #-16]!
| -    377c:      910003fd        mov     x29, sp
| -    3780:      94000814        bl      57d0 <main@@Base+0x1810>
| -    3784:      a8c17bfd        ldp     x29, x30, [sp], #16
| -    3788:      d65f03c0        ret
| +0000000000003688 <_init@@Base>:
| +    3688:      a9bf7bfd        stp     x29, x30, [sp, #-16]!
| +    368c:      910003fd        mov     x29, sp
| +    3690:      9400084d        bl      57c4 <wcrtomb at plt+0x1904>
| +    3694:      a8c17bfd        ldp     x29, x30, [sp], #16
| +    3698:      d65f03c0        ret

In this example from comparing a cross/native grep for arm64, you can
see that the .init section is moved. That makes the remainder
essentially undiffable.

The example also shows a different address in the bl instruction. I
think that this cloned bug should not be about such addresses in
instructions, but only about the offsets on the left hand side.

> (It's safe to ignore these addresses because the start/end of the
> section already appear elsewhere in the diffed output.)

Given this, completely ignoring such offsets should be ok.

I consider this bug a major blocker of cross/native reproducible builds.
Let's see whether that feature is important to anyone else. ;)

Helmut



More information about the Reproducible-builds mailing list