Skip to content

Commit

Permalink
avoid the -Os option
Browse files Browse the repository at this point in the history
  • Loading branch information
lukaszcz committed Sep 21, 2023
1 parent 6050b40 commit 4b8b6de
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions app/Commands/Extra/Compile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,32 +170,36 @@ commonArgs buildDir o outfile =
| otherwise -> []
)

optimizationOption :: CompileOptions -> String
optimizationOption o =
"-O" <> show (maybe defaultOptLevel (max 1) (o ^. compileOptimizationLevel))
where
defaultOptLevel :: Int
defaultOptLevel
| o ^. compileDebug = debugClangOptimizationLevel
| otherwise = defaultClangOptimizationLevel

native64Args :: Path Abs Dir -> CompileOptions -> Path Abs File -> Path Abs File -> [String]
native64Args buildDir o outfile inputFile =
commonArgs buildDir o outfile
<> [ "-DARCH_NATIVE64",
"-DAPI_LIBC",
"-m64",
"-O" <> show (maybe defaultOptLevel (max 1) (o ^. compileOptimizationLevel)),
optimizationOption o,
toFilePath inputFile
]
<> ( if
| not (o ^. compilePreprocess || o ^. compileAssembly) ->
["-ljuvix"]
| otherwise -> []
)
where
defaultOptLevel :: Int
defaultOptLevel
| o ^. compileDebug = debugClangOptimizationLevel
| otherwise = defaultClangOptimizationLevel

wasiArgs :: Path Abs Dir -> CompileOptions -> Path Abs File -> Path Abs File -> Path Abs Dir -> [String]
wasiArgs buildDir o outfile inputFile sysrootPath =
commonArgs buildDir o outfile
<> [ "-DARCH_WASM32",
"-DAPI_WASI",
"-Os",
optimizationOption o,
"-nodefaultlibs",
"--target=wasm32-wasi",
"--sysroot",
Expand Down

0 comments on commit 4b8b6de

Please sign in to comment.