summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortomsmeding <tom.smeding@gmail.com>2017-01-31 18:42:14 +0100
committertomsmeding <tom.smeding@gmail.com>2017-01-31 18:42:14 +0100
commit3eb9d5d4fe233d08f09198744e6e7328605c8275 (patch)
tree64478f406802dd113c563d68dff2955e9104d8d5
parente85b818023fe409468b9802ce2923b5f26974bc4 (diff)
Hide string literals in object file
-rw-r--r--codegen.hs3
1 files changed, 3 insertions, 0 deletions
diff --git a/codegen.hs b/codegen.hs
index b8d8c54..b9f822a 100644
--- a/codegen.hs
+++ b/codegen.hs
@@ -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]