@@ -220,7 +220,8 @@ function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String,
220220 tmp = mktempdir ()
221221 sysimg_source_path = Base. find_source_file (" sysimg.jl" )
222222 base_dir = dirname (sysimg_source_path)
223- tmp_corecompiler_ji = joinpath (tmp, " corecompiler.ji" )
223+ tmp_corecompiler_o = joinpath (tmp, " corecompiler-o.a" )
224+ tmp_corecompiler_sl = joinpath (tmp, " corecompiler." * Libdl. dlext)
224225 tmp_sys_o = joinpath (tmp, " sys-o.a" )
225226 # This naming convention (`sys-o.a`) is necessary to make the sysimage
226227 # work on macOS.
@@ -245,27 +246,34 @@ function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String,
245246 sysimage_build_args = Cmd (sysimage_build_args_strs)
246247
247248 cd (base_dir) do
248- spinner = TerminalSpinners. Spinner (msg = " PackageCompiler: creating compiler .ji image (incremental=false)" )
249+ spinner = TerminalSpinners. Spinner (msg = " PackageCompiler: creating compiler sysimage (incremental=false)" )
249250 TerminalSpinners. @spin spinner begin
250- # Create corecompiler.ji
251+ # Create corecompiler object file
251252 cmd = ` $(get_julia_cmd ()) --cpu-target $cpu_target
252- --output-ji $tmp_corecompiler_ji $sysimage_build_args
253+ --output-o $tmp_corecompiler_o $sysimage_build_args
253254 $compiler_source_path $compiler_args `
254255 @debug " running $cmd "
255256
256257 read (cmd)
258+
259+ # Create shared library from object file
260+ create_sysimg_from_object_file (String[tmp_corecompiler_o],
261+ tmp_corecompiler_sl;
262+ version= nothing ,
263+ soname= nothing ,
264+ compat_level= " major" )
257265 end
258266
259267 spinner = TerminalSpinners. Spinner (msg = " PackageCompiler: compiling fresh sysimage (incremental=false)" )
260268 TerminalSpinners. @spin spinner begin
261- # Use that to create sys.ji
269+ # Use the compiler sysimage to create sys.ji
262270 new_sysimage_content = rewrite_sysimg_jl_only_needed_stdlibs (stdlibs)
263271 new_sysimage_content *= " \n empty!(Base.atexit_hooks)\n "
264272 new_sysimage_source_path = joinpath (tmp, " sysimage_packagecompiler_$(uuid1 ()) .jl" )
265273 write (new_sysimage_source_path, new_sysimage_content)
266274 try
267275 cmd = addenv (` $(get_julia_cmd ()) --cpu-target $cpu_target
268- --sysimage=$tmp_corecompiler_ji
276+ --sysimage=$tmp_corecompiler_sl
269277 $sysimage_build_args --output-o=$tmp_sys_o
270278 $new_sysimage_source_path $compiler_args ` ,
271279 " JULIA_LOAD_PATH" => " @stdlib" )
@@ -281,7 +289,8 @@ function create_fresh_base_sysimage(stdlibs::Vector{String}; cpu_target::String,
281289
282290 finally
283291 rm (new_sysimage_source_path; force= true )
284- rm (tmp_corecompiler_ji; force= true )
292+ rm (tmp_corecompiler_o; force= true )
293+ rm (tmp_corecompiler_sl; force= true )
285294 rm (tmp_sys_o; force= true )
286295 end
287296 end
0 commit comments