Skip to content

Commit fc4b079

Browse files
authored
Merge pull request #48809 from ven-k/vkb/imageing-default
Fix imaging value for generating sysimages for multiple targets
2 parents 1aa65c3 + acd51cf commit fc4b079

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

src/jitlayers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ GlobalVariable *jl_emit_RTLD_DEFAULT_var(Module *M) JL_NOTSAFEPOINT;
7373
DataLayout jl_create_datalayout(TargetMachine &TM) JL_NOTSAFEPOINT;
7474

7575
static inline bool imaging_default() JL_NOTSAFEPOINT {
76-
return jl_options.image_codegen || (jl_generating_output() && jl_options.use_pkgimages);
76+
return jl_options.image_codegen || (jl_generating_output() && (!jl_options.incremental || jl_options.use_pkgimages));
7777
}
7878

7979
struct OptimizationOptions {

test/cmdlineargs.jl

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,37 @@ let exename = `$(Base.julia_cmd()) --startup-file=no --color=no`
726726
end
727727
end
728728

729+
# Object file with multiple cpu targets
730+
@testset "Object file for multiple microarchitectures" begin
731+
julia_path = joinpath(Sys.BINDIR, Base.julia_exename())
732+
outputo_file = tempname()
733+
write(outputo_file, "1")
734+
object_file = tempname() * ".o"
735+
736+
# This is to test that even with `pkgimages=no`, we can create object file
737+
# with multiple cpu-targets
738+
# The cmd is checked for `--object-o` as soon as it is run. So, to avoid long
739+
# testing times, intentionally don't pass `--sysimage`; when we reach the
740+
# corresponding error, we know that `check_cmdline` has already passed
741+
let v = readchomperrors(`$julia_path
742+
--cpu-target='native;native'
743+
--output-o=$object_file $outputo_file
744+
--pkgimages=no`)
745+
746+
@test v[1] == false
747+
@test v[2] == ""
748+
@test !contains(v[3], "More than one command line CPU targets specified")
749+
@test v[3] == "ERROR: File \"boot.jl\" not found"
750+
end
751+
752+
# This is to test that with `pkgimages=yes`, multiple CPU targets are parsed.
753+
# We intentionally fail fast due to a lack of an `--output-o` flag.
754+
let v = readchomperrors(`$julia_path --cpu-target='native;native' --pkgimages=yes`)
755+
@test v[1] == false
756+
@test v[2] == ""
757+
@test contains(v[3], "More than one command line CPU targets specified")
758+
end
759+
end
729760

730761
# Find the path of libjulia (or libjulia-debug, as the case may be)
731762
# to use as a dummy shlib to open

0 commit comments

Comments
 (0)