Description
I use a gitian build environment to compile rust source in a well-defined/stabile environment. When using rust 1.32 (rust-1.32.0-1.el7.x86_64.rpm on Centos 7), I can deterministically build object/binary (with the help of RUSTFLAGS="--remap-path-prefix=%{_builddir}=BUILDDIR -C link-arg=-Wl,--build-id=0x%{githash},-S"
while running inside an rpmbuild
) -- like, the build process when using 1.32 is so deterministic between runs that I can use diff
(or cmp
or sha256sum
) to verify that two products/executables produced on different runs are identical.
However, as of 1.33 (rust-1.33.0-2.el7.x86_64.rpm on Centos 7), I get significant variation from one run to another:
$ size *float-[12]/build/usr/bin/program
text data bss dec hex filename
6154818 157808 688 6313314 605562 20190329-float-1/build/usr/bin/program
6148249 157328 688 6306265 6039d9 20190329-float-2/build/usr/bin/program
Among other things, the layout of the address space seems to vary (sample):
$ sdiff <(objdump -d *float-1/build/usr/bin/program) <(objdump -d *float-2/build/usr/bin/program) | head -20
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx904e-20190329-float-1/bui | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx904e-20190329-float-2/bui
Disassembly of section .init: Disassembly of section .init:
00000000001438b0 <_init>: | 00000000001430b0 <_init>:
1438b0: 48 83 ec 08 sub $0x8,%rsp | 1430b0: 48 83 ec 08 sub $0x8,%rsp
1438b4: 48 8b 05 c5 19 6c 00 mov 0x6c19c5(%rip) | 1430b4: 48 8b 05 ed 00 6c 00 mov 0x6c00ed(%rip)
1438bb: 48 85 c0 test %rax,%rax | 1430bb: 48 85 c0 test %rax,%rax
1438be: 74 05 je 1438c5 <_init+ | 1430be: 74 05 je 1430c5 <_init+
1438c0: e8 53 01 00 00 callq 143a18 <.plt.g | 1430c0: e8 53 01 00 00 callq 143218 <.plt.g
1438c5: 48 83 c4 08 add $0x8,%rsp | 1430c5: 48 83 c4 08 add $0x8,%rsp
1438c9: c3 retq | 1430c9: c3 retq
Disassembly of section .plt: Disassembly of section .plt:
00000000001438d0 <.plt>: | 00000000001430d0 <.plt>:
1438d0: ff 35 ba 16 6b 00 pushq 0x6b16ba(%rip) | 1430d0: ff 35 42 ff 6a 00 pushq 0x6aff42(%rip)
1438d6: ff 25 bc 16 6b 00 jmpq *0x6b16bc(%rip | 1430d6: ff 25 44 ff 6a 00 jmpq *0x6aff44(%rip
Was something intentionally changed in 1.33 that might cause this behavior?
EDIT incorporating subsequent info:
I found a smallish open-source project that demonstrates the issue. Run
build.sh.txt -- under 1.32, I get all good; under 1.33, I get bad stuff.