diff options
author | tomsmeding <tom.smeding@gmail.com> | 2017-01-31 18:42:14 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2017-01-31 18:42:14 +0100 |
commit | 3eb9d5d4fe233d08f09198744e6e7328605c8275 (patch) | |
tree | 64478f406802dd113c563d68dff2955e9104d8d5 | |
parent | e85b818023fe409468b9802ce2923b5f26974bc4 (diff) |
Hide string literals in object file
-rw-r--r-- | codegen.hs | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -15,6 +15,8 @@ import qualified LLVM.General.AST.Float as A.F -- import qualified LLVM.General.AST.Name as A -- import qualified LLVM.General.AST.Instruction as A import qualified LLVM.General.AST.IntegerPredicate as A +import qualified LLVM.General.AST.Linkage as A.L +-- import qualified LLVM.General.AST.Visibility as A.V import qualified LLVM.General.AST as A import Debug.Trace @@ -236,6 +238,7 @@ genStringLiterals = liftM stringLiterals get >>= return . map gen gen :: (LLName, String) -> A.Definition gen (name, str) = A.GlobalDefinition $ A.globalVariableDefaults { A.G.name = A.Name name, + A.G.linkage = A.L.Private, A.G.isConstant = True, A.G.type' = A.ptr (A.i8), A.G.initializer = Just $ A.C.Array A.i8 $ [A.C.Int 8 (fromIntegral (ord c)) | c <- str] ++ [A.C.Int 8 0] |