mirror of
https://github.com/ilyakooo0/Idris-dev.git
synced 2024-09-11 08:55:23 +03:00
Strip unreachable code/data
This commit is contained in:
parent
fb1cc4e1ce
commit
d13fa5cfb3
@ -14,7 +14,7 @@ RANLIB ?=ranlib
|
||||
CABAL :=cabal
|
||||
# IDRIS_ENABLE_STATS should not be set in final release
|
||||
# Any flags defined here which alter the RTS API must also be added to src/IRTS/CodegenC.hs
|
||||
CFLAGS :=-O2 -Wall -std=c99 -D_POSIX_C_SOURCE=200809L -DHAS_PTHREAD -DIDRIS_ENABLE_STATS $(CFLAGS)
|
||||
CFLAGS :=-O2 -Wall -std=c99 -pipe -fdata-sections -ffunction-sections -D_POSIX_C_SOURCE=200809L -DHAS_PTHREAD -DIDRIS_ENABLE_STATS $(CFLAGS)
|
||||
|
||||
# CABALFLAGS :=
|
||||
CABALFLAGS += --enable-tests
|
||||
|
@ -79,18 +79,22 @@ codegenC' defs out exec incs objs libs flags exports iface dbg
|
||||
libFlags <- getLibFlags
|
||||
incFlags <- getIncFlags
|
||||
envFlags <- getEnvFlags
|
||||
let stackFlag = if isWindows then ["-Wl,--stack,16777216"] else []
|
||||
let stripFlag = if isDarwin then "-dead_strip" else "-Wl,-gc-sections"
|
||||
let stackFlags = if isWindows then ["-Wl,--stack,16777216"] else []
|
||||
let linkFlags = stripFlag : stackFlags
|
||||
let args = gccDbg dbg ++
|
||||
gccFlags iface ++
|
||||
-- # Any flags defined here which alter the RTS API must also be added to config.mk
|
||||
["-std=c99", "-D_POSIX_C_SOURCE=200809L", "-DHAS_PTHREAD", "-DIDRIS_ENABLE_STATS",
|
||||
"-I."] ++ objs ++ envFlags ++
|
||||
(if (exec == Executable) then [] else ["-c"]) ++
|
||||
[ "-std=c99", "-pipe"
|
||||
, "-fdata-sections", "-ffunction-sections"
|
||||
, "-D_POSIX_C_SOURCE=200809L", "-DHAS_PTHREAD", "-DIDRIS_ENABLE_STATS"
|
||||
, "-I."] ++ objs ++ envFlags ++
|
||||
(if (exec == Executable) then linkFlags else ["-c"]) ++
|
||||
[tmpn] ++
|
||||
(if not iface then libFlags else []) ++
|
||||
incFlags ++
|
||||
(if not iface then libs else []) ++
|
||||
flags ++ stackFlag ++
|
||||
flags ++
|
||||
["-o", out]
|
||||
-- putStrLn (show args)
|
||||
exit <- rawSystem comp args
|
||||
|
@ -10,6 +10,7 @@ module Util.System( tempfile
|
||||
, withTempdir
|
||||
, rmFile
|
||||
, catchIO
|
||||
, isDarwin
|
||||
, isWindows
|
||||
, writeSource
|
||||
, writeSourceText
|
||||
@ -50,6 +51,9 @@ catchIO = CE.catch
|
||||
isWindows :: Bool
|
||||
isWindows = os `elem` ["win32", "mingw32", "cygwin32"]
|
||||
|
||||
isDarwin :: Bool
|
||||
isDarwin = os == "darwin"
|
||||
|
||||
-- | Create a temp file with the extensiom ext (in the format ".xxx")
|
||||
tempfile :: String -> IO (FilePath, Handle)
|
||||
tempfile ext = do dir <- getTemporaryDirectory
|
||||
|
Loading…
Reference in New Issue
Block a user