@@ -23,7 +23,7 @@ import Debug.Trace
23import Paths_idris
23import Paths_idris
25ibcVersion :: Word8
25ibcVersion :: Word8
26−ibcVersion = 36
26+ibcVersion = 37
28data IBCFile = IBCFile { ver :: Word8,
28data IBCFile = IBCFile { ver :: Word8,
29 sourcefile :: FilePath,
29 sourcefile :: FilePath,
@@ -40,6 +40,7 @@ data IBCFile = IBCFile { ver :: Word8,
40 ibc_keywords :: [String],
40 ibc_keywords :: [String],
41 ibc_objs :: [(Codegen, FilePath)],
41 ibc_objs :: [(Codegen, FilePath)],
42 ibc_libs :: [(Codegen, String)],
42 ibc_libs :: [(Codegen, String)],
43+ ibc_cgflags :: [(Codegen, String)],
43 ibc_dynamic_libs :: [String],
44 ibc_dynamic_libs :: [String],
44 ibc_hdrs :: [(Codegen, String)],
45 ibc_hdrs :: [(Codegen, String)],
45 ibc_access :: [(Name, Accessibility)],
46 ibc_access :: [(Name, Accessibility)],
@@ -57,7 +58,7 @@ deriving instance Binary IBCFile
59initIBC :: IBCFile
60initIBC :: IBCFile
60−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
61+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
62loadIBC :: FilePath -> Idris ()
63loadIBC :: FilePath -> Idris ()
63loadIBC fp = do iLOG $ "Loading ibc " ++ fp
64loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -115,6 +116,7 @@ ibc i (IBCKeyword n) f = return f { ibc_keywords = n : ibc_keywords f }
115ibc i (IBCImport n) f = return f { ibc_imports = n : ibc_imports f }
116ibc i (IBCImport n) f = return f { ibc_imports = n : ibc_imports f }
116ibc i (IBCObj tgt n) f = return f { ibc_objs = (tgt, n) : ibc_objs f }
117ibc i (IBCObj tgt n) f = return f { ibc_objs = (tgt, n) : ibc_objs f }
117ibc i (IBCLib tgt n) f = return f { ibc_libs = (tgt, n) : ibc_libs f }
118ibc i (IBCLib tgt n) f = return f { ibc_libs = (tgt, n) : ibc_libs f }
119+ibc i (IBCCGFlag tgt n) f = return f { ibc_cgflags = (tgt, n) : ibc_cgflags f }
118ibc i (IBCDyLib n) f = return f {ibc_dynamic_libs = n : ibc_dynamic_libs f }
120ibc i (IBCDyLib n) f = return f {ibc_dynamic_libs = n : ibc_dynamic_libs f }
119ibc i (IBCHeader tgt n) f = return f { ibc_hdrs = (tgt, n) : ibc_hdrs f }
121ibc i (IBCHeader tgt n) f = return f { ibc_hdrs = (tgt, n) : ibc_hdrs f }
120ibc i (IBCDef n) f = case lookupDef n (tt_ctxt i) of
122ibc i (IBCDef n) f = case lookupDef n (tt_ctxt i) of
@@ -155,6 +157,7 @@ process i fn
155 pKeywords (ibc_keywords i)
157 pKeywords (ibc_keywords i)
156 pObjs (ibc_objs i)
158 pObjs (ibc_objs i)
157 pLibs (ibc_libs i)
159 pLibs (ibc_libs i)
160+ pCGFlags (ibc_cgflags i)
158 pDyLibs (ibc_dynamic_libs i)
161 pDyLibs (ibc_dynamic_libs i)
159 pHdrs (ibc_hdrs i)
162 pHdrs (ibc_hdrs i)
160 pDefs (ibc_defs i)
163 pDefs (ibc_defs i)
@@ -259,6 +262,9 @@ pObjs os = mapM_ (uncurry addObjectFile) os
259pLibs :: [(Codegen, String)] -> Idris ()
262pLibs :: [(Codegen, String)] -> Idris ()
260pLibs ls = mapM_ (uncurry addLib) ls
263pLibs ls = mapM_ (uncurry addLib) ls
265+pCGFlags :: [(Codegen, String)] -> Idris ()
266+pCGFlags ls = mapM_ (uncurry addFlag) ls
262pDyLibs :: [String] -> Idris ()
268pDyLibs :: [String] -> Idris ()
263pDyLibs ls = do res <- mapM (addDyLib . return) ls
269pDyLibs ls = do res <- mapM (addDyLib . return) ls
264 mapM_ checkLoad res
270 mapM_ checkLoad res
@@ -810,7 +816,7 @@ instance Binary Totality where
810 _ -> error "Corrupted binary data for Totality"
816 _ -> error "Corrupted binary data for Totality"
812instance Binary IBCFile where
818instance Binary IBCFile where
813− put x@(IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25)
819+ put x@(IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26)
814 = {-# SCC "putIBCFile" #-}
820 = {-# SCC "putIBCFile" #-}
815 do put x1
821 do put x1
@@ -837,6 +843,7 @@ instance Binary IBCFile where
841 = do x1 <- get
848 = do x1 <- get
842 if x1 == ibcVersion then
849 if x1 == ibcVersion then
@@ -864,7 +871,8 @@ instance Binary IBCFile where
864 x23 <- get
871 x23 <- get
865 x24 <- get
872 x24 <- get
866 x25 <- get
873 x25 <- get
867− return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25)
875+ return (IBCFile x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12 x13 x14 x15 x16 x17 x18 x19 x20 x21 x22 x23 x24 x25 x26)
868 else return (initIBC { ver = x1 })
876 else return (initIBC { ver = x1 })
870instance Binary FnOpt where
878instance Binary FnOpt where