All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Keeping <john@metanate.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC PATCH] toolchain/toolchain-wrapper: remove --build-id=none option
Date: Thu, 12 Nov 2020 20:03:26 +0000	[thread overview]
Message-ID: <20201112200326.4e6f5708.john@metanate.com> (raw)
In-Reply-To: <20201112110717.634931e0.john@metanate.com>

On Thu, 12 Nov 2020 11:07:17 +0000
John Keeping <john@metanate.com> wrote:

> On Wed, 11 Nov 2020 21:58:16 +0100
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> 
> > However, I would still doubt that build-ids are reproducible, even when
> > explicitly set to 'sha1', which has been the default since 2007 now, and
> > given that the commit referenced above was done because indeed they were
> > not reproducible...
> 
> The comment on that commit says it's about building in different output
> directories, but commit 71d6901 a month later added -ffile-prefix-map
> (or overrides of __FILE__/__BASE_FILE__ for older compilers), so perhaps
> that has resolved the problem that b285c80143 saw?
> 
> I ran two builds (admittedly of a minimal configuration - although it
> does include libmount.so.1.1.0 which is referenced in the snippet below)
> and the only differences I saw were in .pyc files which seems to be a
> result of https://bugs.python.org/issue37596 - I'm planning to
> experiment with exporting PYTHONHASHSEED when BR2_REPRODUCIBLE is set to
> see if that works around the issue here.

I've done some more testing on this and unfortunately building in a
different directory does lead to non-reproducible output, including of
build-ids.

For the build-id, the issue is that .symtab includes STT_FILE references
to crti.o & crtn.o (and possibly start.o and others for executables) by
absolute path.  These entries are removed by strip(1) so the end result
doesn't include it, but it seems that this is part of the content used
to generate the build-id.

Weirdly, I don't see that for x86_64 but I do for ARM32.

However, ignoring build-ids, building in a different directory (or at
least a directory with a different path length) leads to other
differences in the output.  I see output like:

	-  [ 6] .dynstr           STRTAB          00010f10 000f10 0006dc 00   A  0   0  1
	+  [ 6] .dynstr           STRTAB          00010f10 000f10 0006dd 00   A  0   0  1

where the size differs by one (because my build directories happened to
differ in length by one I think) and then the offsets of everything else
are shifted correspondingly.

The diff for .dynstr there is:

	# readelf --wide --decompress --hex-dump=.dynstr {}
	@@ -105,9 +105,9 @@
	   0x00011570 005f5f6c 6962635f 73746172 745f6d61 .__libc_start_ma
	   0x00011580 696e0073 7973636f 6e660047 4c494243 in.sysconf.GLIBC
	   0x00011590 5f322e34 00474c49 42435f32 2e323800 _2.4.GLIBC_2.28.
	   0x000115a0 00585858 58585858 58585858 58585858 .XXXXXXXXXXXXXXX
	   0x000115b0 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
	   0x000115c0 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
	   0x000115d0 58585858 58585858 58585858 58585858 XXXXXXXXXXXXXXXX
	-  0x000115e0 58585858 58585858 58585800          XXXXXXXXXXX.
	+  0x000115e0 58585858 58585858 58585858 00       XXXXXXXXXXXX.

So it looks like if the build path is different, then there will be
differences in the output independent of the build-id,

My conclusion from this is that BR2_REPRODUCIBLE is more broken than I
thought :-(   But build-id is not itself a problem as far as I can tell
- when the build-id is different then generally there is also some other
difference in the file (even when stripped).


John

  reply	other threads:[~2020-11-12 20:03 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-11 19:48 [Buildroot] [RFC PATCH] toolchain/toolchain-wrapper: remove --build-id=none option John Keeping
2020-11-11 20:58 ` Yann E. MORIN
2020-11-11 21:00   ` Yann E. MORIN
2020-11-12 11:07   ` John Keeping
2020-11-12 20:03     ` John Keeping [this message]
2020-11-12 21:11       ` Yann E. MORIN
2020-11-12 20:58     ` Yann E. MORIN

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201112200326.4e6f5708.john@metanate.com \
    --to=john@metanate.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.