Skip to content

Commit 7624f80

Browse files
committed
Add --export-abi arg to juliac.jl
1 parent 7891157 commit 7624f80

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

contrib/juliac/juliac.jl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ julia_cmd = `$(Base.julia_cmd()) --startup-file=no --history-file=no`
1313
cpu_target = get(ENV, "JULIA_CPU_TARGET", nothing)
1414
julia_cmd_target = `$(Base.julia_cmd(;cpu_target)) --startup-file=no --history-file=no`
1515
output_type = nothing # exe, sharedlib, sysimage
16+
abi_export_file = nothing
1617
outname = nothing
1718
file = nothing
1819
add_ccallables = false
@@ -25,6 +26,7 @@ if help !== nothing
2526
"""
2627
Usage: julia juliac.jl [--output-exe | --output-lib | --output-sysimage] <name> [options] <file.jl>
2728
--experimental --trim=<no,safe,unsafe,unsafe-warn> Only output code statically determined to be reachable
29+
--export-abi <file> Emit type / function information for the ABI (in JSON format)
2830
--compile-ccallable Include all methods marked `@ccallable` in output
2931
--relative-rpath Configure the library / executable to lookup all required libraries in an adjacent "julia/" folder
3032
--verbose Request verbose output
@@ -96,6 +98,10 @@ let i = 1
9698
i == length(ARGS) && error("Output specifier requires an argument")
9799
global outname = ARGS[i+1]
98100
i += 1
101+
elseif arg == "--export-abi"
102+
i == length(ARGS) && error("Output specifier requires an argument")
103+
global abi_export_file = ARGS[i+1]
104+
i += 1
99105
elseif arg == "--compile-ccallable"
100106
global add_ccallables = true
101107
elseif arg == "--verbose"
@@ -168,7 +174,11 @@ function compile_products(enable_trim::Bool)
168174
end
169175

170176
# Compile the Julia code
171-
cmd = addenv(`$julia_cmd_target --project=$(Base.active_project()) --output-o $img_path --output-incremental=no $strip_args $julia_args $(joinpath(@__DIR__,"juliac-buildscript.jl")) $absfile $output_type $add_ccallables`, "OPENBLAS_NUM_THREADS" => 1, "JULIA_NUM_THREADS" => 1)
177+
args = String[absfile, output_type, string(add_ccallables)]
178+
if abi_export_file !== nothing
179+
push!(args, abi_export_file)
180+
end
181+
cmd = addenv(`$julia_cmd_target --project=$(Base.active_project()) --output-o $img_path --output-incremental=no $strip_args $julia_args $(joinpath(@__DIR__,"juliac-buildscript.jl")) $(args)`, "OPENBLAS_NUM_THREADS" => 1, "JULIA_NUM_THREADS" => 1)
172182
verbose && println("Running: $cmd")
173183
if !success(pipeline(cmd; stdout, stderr))
174184
println(stderr, "\nFailed to compile $file")

0 commit comments

Comments
 (0)