Skip to content

Commit

Permalink
Incorporate RalphAS's fix for translations units being dropped from…
Browse files Browse the repository at this point in the history
… custom system images.
  • Loading branch information
staticfloat committed Jun 18, 2018
1 parent 796fb2a commit 4718cd5
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions contrib/build_sysimg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,12 @@ function link_sysimg(sysimg_path=nothing, cc=find_system_compiler(), debug=false
end

sysimg_file = "$sysimg_path.$(Libdl.dlext)"
info("Linking sys.$(Libdl.dlext)")
info("$cc $(join(FLAGS, ' ')) -o $sysimg_file $sysimg_path.o")
cc_cmd = `$cc $FLAGS -o $sysimg_path.tmp -Wl,--whole-archive $sysimg_path.o -Wl,--no-whole-archive`
@info("Linking sys.$(Libdl.dlext) with $cc_cmd")
# Windows has difficulties overwriting a file in use so we first link to a temp file
if Sys.iswindows() && isfile(sysimg_file)
if success(pipeline(`$cc $FLAGS -o $sysimg_path.tmp $sysimg_path.o`; stdout=stdout, stderr=stderr))
mv(sysimg_file, "$sysimg_file.old"; force=true)
mv("$sysimg_path.tmp", sysimg_file; force=true)
end
else
run(`$cc $FLAGS -o $sysimg_file $sysimg_path.o`)
if success(pipeline(cc_cmd; stdout=stdout, stderr=stderr))
mv(sysimg_file, "$sysimg_file.old"; force=true)
mv("$sysimg_path.tmp", sysimg_file; force=true)
end
@info("System image successfully built at $sysimg_path.$(Libdl.dlext)")
return
Expand Down

0 comments on commit 4718cd5

Please sign in to comment.