git: 85434cac6ef2 - stable/14 - Fix EFI loader reproducibility with lld
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 Aug 2024 06:33:53 UTC
The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=85434cac6ef20d42653c966b317d5b2ae9c95973 commit 85434cac6ef20d42653c966b317d5b2ae9c95973 Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2024-08-11 19:48:27 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2024-08-15 06:33:35 +0000 Fix EFI loader reproducibility with lld When the various loaders under stand/efi are built, the resulting binaries differ over multiple runs, even if WITH_REPRODUCIBLE_BUILD is used. This is caused by lld multithreading and the custom linker scripts for the loaders, and affects the following binaries: * loader_4th.efi * loader_4th.sym * loader_4th.sym.full * loader_lua.efi * loader_lua.sym * loader_lua.sym.full * loader_simp.efi * loader_simp.sym * loader_simp.sym.full Work around this by disabling lld threading for these binaries. Reviewed by: emaste MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D46271 (cherry picked from commit f5ce3f4ef562ea9fc4d8f9c13c268f48a5bacba7) --- stand/efi/loader/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index b3395bdfdf53..02563681c3e8 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -106,6 +106,11 @@ LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -pie LDFLAGS+= -Wl,--no-dynamic-linker .endif +# When lld is using multiple threads, which it does by default, it can +# result in non-reproducible output with the custom linker script. Work +# around this by disabling threading. +LDFLAGS.lld+= -Wl,--threads=1 + CLEANFILES+= ${LOADER}.efi ${LOADER}.efi: ${PROG}