From: Vagrant Cascadian <vagrant@reproducible-builds.org>
To: opensbi@lists.infradead.org
Subject: [PATCH] reproducible builds: strip embedded file paths
Date: Sun, 21 Nov 2021 11:20:02 -0800 [thread overview]
Message-ID: <875ysl2u59.fsf@ponder> (raw)
In-Reply-To: <8607f8cc66989b754056f4396c16178bdc23c48a.camel@126.com>
On 2021-11-22, Xiang W. wrote:
> ? 2021-11-18???? 17:05 -0800?Vagrant Cascadian???
>>
>> Unfortunately, the use of __FILE__ can embed the absolute build path
>> in
>> the resulting binary, resulting in different binaries depending on
>> which
>> path the build was performed in.
>
> Under what scenarios will absolute paths be embed.
In each of the directories below, I built using the same toolchain from
the same git commit...
$ cd /home/vagrant/src/opensbi/opensbi1
$ CROSS_COMPILE=riscv64-linux-gnu- make V=1 FW_PAYLOAD=n PLATFORM=generic
...
$ strings build/platform/generic/firmware/fw_dynamic.bin | grep /home/vagrant
/home/vagrant/src/opensbi/opensbi1/lib/sbi/riscv_asm.c
$ cd /home/vagrant/src/opensbi/opensbi2
$ CROSS_COMPILE=riscv64-linux-gnu- make V=1 FW_PAYLOAD=n PLATFORM=generic
...
$ strings build/platform/generic/firmware/fw_dynamic.bin | grep /home/vagrant
/home/vagrant/src/opensbi/opensbi2/lib/sbi/riscv_asm.c
With the patch applied:
$ cd /home/vagrant/src/opensbi/opensbi3
$ CROSS_COMPILE=riscv64-linux-gnu- make V=1 FW_PAYLOAD=n PLATFORM=generic
...
$ strings build/platform/generic/firmware/fw_dynamic.bin | grep /home/vagrant
$ strings build/platform/generic/firmware/fw_dynamic.bin | grep riscv_asm.c
./lib/sbi/riscv_asm.c
A relative path within the source should be sufficient for the debug
message to properly identify the relevent source files...
An alternate approach would be to not use __FILE__ at all, but that
would probably take more code than passing -ffile-prefix-map at compile
time.
Thanks!
live well,
vagrant
next prev parent reply other threads:[~2021-11-21 19:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-19 1:05 [PATCH] reproducible builds: strip embedded file paths Vagrant Cascadian
2021-11-21 16:40 ` Xiang W
2021-11-21 16:45 ` Jessica Clarke
2021-11-21 19:20 ` Vagrant Cascadian [this message]
2021-11-22 1:45 ` Xiang W
2021-11-22 3:59 ` Vagrant Cascadian
2021-11-22 4:43 ` Anup Patel
2021-11-22 5:44 ` Xiang W
2021-11-27 1:48 ` Vagrant Cascadian
2021-11-27 4:20 ` Anup Patel
2021-11-27 11:46 ` Xiang W
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=875ysl2u59.fsf@ponder \
--to=vagrant@reproducible-builds.org \
--cc=opensbi@lists.infradead.org \
/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.