@@ -23,7 +23,7 @@ import Debug.Trace
2323import Paths_idris
2424
2525ibcVersion :: Word8
26−ibcVersion = 36
26+ibcVersion = 37
2727
2828data IBCFile = IBCFile { ver :: Word8,
2929 sourcefile :: FilePath,
@@ -40,6 +40,7 @@ data IBCFile = IBCFile { ver :: Word8,
4040 ibc_keywords :: [String],
4141 ibc_objs :: [(Codegen, FilePath)],
4242 ibc_libs :: [(Codegen, String)],
43+ ibc_cgflags :: [(Codegen, String)],
4344 ibc_dynamic_libs :: [String],
4445 ibc_hdrs :: [(Codegen, String)],
4546 ibc_access :: [(Name, Accessibility)],
@@ -57,7 +58,7 @@ deriving instance Binary IBCFile
5758!-}
5859
5960initIBC :: IBCFile
60−initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
61+initIBC = IBCFile ibcVersion "" [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] [] []
6162
6263loadIBC :: FilePath -> Idris ()
6364loadIBC fp = do iLOG $ "Loading ibc " ++ fp
@@ -115,6 +116,7 @@ ibc i (IBCKeyword n) f = return f { ibc_keywords = n : ibc_keywords f }
115116ibc i (IBCImport n) f = return f { ibc_imports = n : ibc_imports f }
116117ibc i (IBCObj tgt n) f = return f { ibc_objs = (tgt, n) : ibc_objs f }
117118ibc 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 }
118120ibc i (IBCDyLib n) f = return f {ibc_dynamic_libs = n : ibc_dynamic_libs f }
119121ibc i (IBCHeader tgt n) f = return f { ibc_hdrs = (tgt, n) : ibc_hdrs f }
120122ibc i (IBCDef n) f = case lookupDef n (tt_ctxt i) of
@@ -155,6 +157,7 @@ process i fn
155157 pKeywords (ibc_keywords i)
156158 pObjs (ibc_objs i)
157159 pLibs (ibc_libs i)
160+ pCGFlags (ibc_cgflags i)
158161 pDyLibs (ibc_dynamic_libs i)
159162 pHdrs (ibc_hdrs i)
160163 pDefs (ibc_defs i)
@@ -259,6 +262,9 @@ pObjs os = mapM_ (uncurry addObjectFile) os
259262pLibs :: [(Codegen, String)] -> Idris ()
260263pLibs ls = mapM_ (uncurry addLib) ls
261264
265+pCGFlags :: [(Codegen, String)] -> Idris ()
266+pCGFlags ls = mapM_ (uncurry addFlag) ls
267+
262268pDyLibs :: [String] -> Idris ()
263269pDyLibs ls = do res <- mapM (addDyLib . return) ls
264270 mapM_ checkLoad res
@@ -810,7 +816,7 @@ instance Binary Totality where
810816 _ -> error "Corrupted binary data for Totality"
811817
812818instance 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)
814820 = {-# SCC "putIBCFile" #-}
815821 do put x1
816822 put x2
@@ -837,6 +843,7 @@ instance Binary IBCFile where
837843 put x23
838844 put x24
839845 put x25
846+ put x26
840847 get
841848 = do x1 <- get
842849 if x1 == ibcVersion then
@@ -864,7 +871,8 @@ instance Binary IBCFile where
864871 x23 <- get
865872 x24 <- get
866873 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)
874+ x26 <- get
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)
868876 else return (initIBC { ver = x1 })
869877
870878instance Binary FnOpt where