Skip to content

Commit 6772e0d

Browse files
authored
move -O2 flag into cflags() (#904)
This will allow users to override the defaults if required.
1 parent 7e46ffa commit 6772e0d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/PackageCompiler.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ function compile_c_init_julia(julia_init_c_file::String, sysimage_name::String,
697697
flags = Base.shell_split(cflags())
698698

699699
o_init_file = splitext(julia_init_c_file)[1] * ".o"
700-
cmd = `-c -O2 -I$include_dir -DJULIAC_PROGRAM_LIBNAME=$(repr(sysimage_name)) $TLS_SYNTAX $(bitflag()) $flags $(march()) -o $o_init_file $julia_init_c_file`
700+
cmd = `-c -I$include_dir -DJULIAC_PROGRAM_LIBNAME=$(repr(sysimage_name)) $TLS_SYNTAX $(bitflag()) $flags $(march()) -o $o_init_file $julia_init_c_file`
701701
run_compiler(cmd)
702702
return o_init_file
703703
end
@@ -880,7 +880,7 @@ function create_executable_from_sysimg(exe_path::String,
880880
mkpath(dirname(exe_path))
881881
flags = Base.shell_split(join((cflags(), ldflags(), ldlibs()), " "))
882882
m = something(march(), ``)
883-
cmd = `-DJULIA_MAIN=\"$julia_main\" $TLS_SYNTAX $(bitflag()) $m -o $(exe_path) $(c_driver_program) -O2 $(rpath_executable()) $flags`
883+
cmd = `-DJULIA_MAIN=\"$julia_main\" $TLS_SYNTAX $(bitflag()) $m -o $(exe_path) $(c_driver_program) $(rpath_executable()) $flags`
884884
run_compiler(cmd)
885885
return nothing
886886
end

src/juliaconfig.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ end
5454

5555
function cflags()
5656
flags = IOBuffer()
57-
print(flags, "-std=gnu99")
57+
print(flags, "-O2 -std=gnu99")
5858
include = shell_escape(julia_includedir())
5959
print(flags, " -I", include)
6060
if Sys.isunix()

0 commit comments

Comments
 (0)