Skip to content

rustc-driver binary is not identical for every build #102299

Closed as not planned
Closed as not planned
@sundeep-kokkonda

Description

@sundeep-kokkonda

The rust build output [[build-dir]]/x86_64-unknown-linux-gnu/stage1/lib/librustc_driver-67046b4f71f47f00.so is not identical for every build. I debugged the issue by comparing all the generated object files between two different builds, the object file '[[build-dir]]/bootstrap/debug/incremental/bootstrap-22qjf7qknjduo/s-gdrx5ab0wu-1spyacv-3unuz3kev23rs/4oqq7pii1co5y8sx.o' is different between two builds. This object file .rodata section is holding the filename with path, and when the path is changed this section is getting chaged and causing final .so file to be changed.

Below is the contents of .rodata section from two build directories.

.rodata section in build directory : build-1
:~/rust/build-1$ objdump -s -j .rodata..L__unnamed_34 ~/rust/build-1/bootstrap/debug/incremental/bootstrap-22qjf7qknjduo/s-gdrx5ab0wu-1spyacv-3unuz3kev23rs/4oqq7pii1co5y8sx.o

/home/skokkonda/rust/build-1/bootstrap/debug/incremental/bootstrap-22qjf7qknjduo/s-gdrx5ab0wu-1spyacv-3unuz3kev23rs/4oqq7pii1co5y8sx.o: file format elf64-x86-64

Contents of section .rodata..L__unnamed_34:
0000 2f686f6d 652f736b 6f6b6b6f 6e64612f /home/skokkonda/
0010 72757374 2f627569 6c642d31 2f783836 rust/build-1/x86
0020 5f36342d 756e6b6e 6f776e2d 6c696e75 _64-unknown-linu
0030 782d676e 752f7374 61676530 2f62696e x-gnu/stage0/bin
0040 2f727573 7463 /rustc

.rodata section in build directory : build-test
:~/rust/build-1$ objdump -s -j .rodata..L__unnamed_34 ~/rust/build-test/bootstrap/debug/incremental/bootstrap-22qjf7qknjduo/s-gds2uitpgl-fm0ssi-193tjef7tbwwd/4oqq7pii1co5y8sx.o

/home/skokkonda/rust/build-test/bootstrap/debug/incremental/bootstrap-22qjf7qknjduo/s-gds2uitpgl-fm0ssi-193tjef7tbwwd/4oqq7pii1co5y8sx.o: file format elf64-x86-64

Contents of section .rodata..L__unnamed_34:
0000 2f686f6d 652f736b 6f6b6b6f 6e64612f /home/skokkonda/
0010 72757374 2f627569 6c642d74 6573742f rust/build-test/
0020 7838365f 36342d75 6e6b6e6f 776e2d6c x86_64-unknown-l
0030 696e7578 2d676e75 2f737461 6765302f inux-gnu/stage0/
0040 62696e2f 72757374 63 bin/rustc

I tried two different builds with identical build path and then compared the binaries, those are identical.

This issue is causing a automated test failure in Yocto build enevironment. Can anyone confirm that is it a bug in rust?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions