summaryrefslogtreecommitdiff
path: root/compiler/llvmGen
diff options
context:
space:
mode:
authorDavid Terei <davidterei@gmail.com>2011-05-02 05:58:56 +1000
committerDavid Terei <davidterei@gmail.com>2011-05-04 15:00:59 -0700
commit22423fc93a008732e426f10f1b545b5d571173f3 (patch)
treeb0a489989b134e9ebd819c271f05678e1f4ef071 /compiler/llvmGen
parent7028041739973c3dc17b23a98c65c892f41f0647 (diff)
downloadhaskell-22423fc93a008732e426f10f1b545b5d571173f3.tar.gz
LLVM: Add support for 64bit OSX. (partial #4210)
Diffstat (limited to 'compiler/llvmGen')
-rw-r--r--compiler/llvmGen/LlvmMangler.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/compiler/llvmGen/LlvmMangler.hs b/compiler/llvmGen/LlvmMangler.hs
index ac187e0a0d..890f71080c 100644
--- a/compiler/llvmGen/LlvmMangler.hs
+++ b/compiler/llvmGen/LlvmMangler.hs
@@ -12,6 +12,8 @@
module LlvmMangler ( llvmFixupAsm ) where
+#include "HsVersions.h"
+
import Control.Exception
import qualified Data.ByteString.Char8 as B
import Data.Char
@@ -23,14 +25,20 @@ infoSec, newInfoSec, newLine, spInst, jmpInst :: B.ByteString
infoSec = B.pack "\t.section\t__STRIP,__me"
newInfoSec = B.pack "\n\t.text"
newLine = B.pack "\n"
-spInst = B.pack ", %esp\n"
jmpInst = B.pack "\n\tjmp"
-infoLen, spFix, labelStart :: Int
-infoLen = B.length infoSec
-spFix = 4
+infoLen, labelStart, spFix :: Int
+infoLen = B.length infoSec
labelStart = B.length jmpInst
+#if x86_64_TARGET_ARCH
+spInst = B.pack ", %rsp\n"
+spFix = 8
+#else
+spInst = B.pack ", %esp\n"
+spFix = 4
+#endif
+
-- Search Predicates
eolPred, dollarPred, commaPred :: Char -> Bool
eolPred = ((==) '\n')