X-Git-Url: http://git.lukelau.me/?p=kaleidoscope-hs.git;a=blobdiff_plain;f=Main.hs;fp=Main.hs;h=64d73e60e0a059864222aec09f8b2ad0803adcfd;hp=c2fff06f82a811a3cc789fc37a3836fb70fa5d26;hb=73c0a2461c164d776e949e17f344e05dd9f6a4a2;hpb=c0262e071b9909756911c55339ba03c78d207332 diff --git a/Main.hs b/Main.hs index c2fff06..64d73e6 100644 --- a/Main.hs +++ b/Main.hs @@ -26,6 +26,7 @@ import LLVM.OrcJIT.CompileLayer import LLVM.PassManager import LLVM.Pretty import LLVM.Target +import Numeric import System.IO import System.IO.Error import Text.Read (readMaybe) @@ -53,7 +54,10 @@ main = do -- This can eventually be used to resolve external functions, e.g. a stdlib call symResolver :: MangledSymbol -> IO (Either JITSymbolError JITSymbol) -symResolver sym = undefined +symResolver sym = do + ptr <- getSymbolAddressInProcess sym + putStrLn $ "Resolving " <> show sym <> " to 0x" <> showHex ptr "" + return (Right (JITSymbol ptr defaultJITSymbolFlags)) repl :: ModuleBuilderT (ReaderT JITEnv IO) () repl = do