Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

boot_stage2: improve reproducibility #1907

Merged
merged 1 commit into from
Sep 11, 2024
Merged

boot_stage2: improve reproducibility #1907

merged 1 commit into from
Sep 11, 2024

Conversation

tpwrules
Copy link
Contributor

@tpwrules tpwrules commented Sep 5, 2024

Specifying the final boot2 source file as a link library here causes the final .elf to be linked directly with that .S, which causes it to be compiled into an object file with a name like /tmp/<random chars>.o. This temporary object name is embedded in the final .elf, so the .elf's contents change after each link even if none of the input files change, breaking reproducibility.

Fix the issue by specifying the source file as the source for an object-only library, then specifying the library's object files as the target link libraries, so the source is compiled in a separate step and only the object is passed to the linker.

Fixes #1906

This makes everything fully reproducible for me and my setup though I have not tested exhaustively and reproducibility is of course something that can't be absolutely proved. Also please keep in mind I'm not knowledgeable with CMake and bumbled into this solution.

Specifying the final boot2 source file as a link library here causes the
final `.elf` to be linked directly with that `.S`, which causes it to be
compiled into an object file with a name like `/tmp/<random chars>.o`.
This temporary object name is embedded in the final `.elf`, so the
`.elf`'s contents change after each link even if none of the input files
change, breaking reproducibility.

Fix the issue by specifying the source file as the source for an
object-only library, then specifying the library's object files as the
target link libraries, so the source is compiled in a separate step and
only the object is passed to the linker.
@tpwrules tpwrules changed the base branch from master to develop September 6, 2024 01:21
@kilograham kilograham added this to the 2.0.1 milestone Sep 11, 2024
@kilograham kilograham merged commit 0ed2840 into raspberrypi:develop Sep 11, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Built ELFs are not reproducible
2 participants