Skip to content

Commit f640e00

Browse files
committed
Add creation of the build-id to the linker flags
1 parent 99594c5 commit f640e00

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "BinaryBuilderBase"
22
uuid = "7f725544-6523-48cd-82d1-3fa08ff4056e"
33
authors = ["Elliot Saba <[email protected]>"]
4-
version = "1.39.1"
4+
version = "1.40.0"
55

66
[deps]
77
Bzip2_jll = "6e34b625-4abd-537c-b88f-471c36dfa7a0"

src/Runner.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,14 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
436436
end
437437
end
438438

439+
function buildid_link_flags!(p::AbstractPlatform, flags::Vector{String})
440+
# build-id is only supported in the ELF format, which is linux+FreeBSD
441+
if Sys.islinux(p) || Sys.isfreebsd(p)
442+
# Use a known algorithm to embed the build-id for reproducibility
443+
push!(flags, "-Wl,--build-id=sha1")
444+
end
445+
end
446+
439447
function clang_compile_flags!(p::AbstractPlatform, flags::Vector{String} = String[])
440448
if lock_microarchitecture
441449
append!(flags, get_march_flags(arch(p), march(p), "clang"))
@@ -540,6 +548,9 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
540548
append!(flags, min_macos_version_linker_flags())
541549
end
542550
end
551+
552+
buildid_link_flags!(p, flags)
553+
543554
return flags
544555
end
545556

@@ -630,6 +641,7 @@ function generate_compiler_wrappers!(platform::AbstractPlatform; bin_path::Abstr
630641
push!(flags, "-Wl,--no-insert-timestamp")
631642
end
632643
sanitize_link_flags!(p, flags)
644+
buildid_link_flags!(p, flags)
633645
return flags
634646
end
635647

0 commit comments

Comments
 (0)