projects
/
ghc-hetmet.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
50f5c84
)
LLVM: Fix bug with osx mangler and jump tables.
author
David Terei
<davidterei@gmail.com>
Sun, 1 May 2011 09:50:03 +0000
(19:50 +1000)
committer
David Terei
<davidterei@gmail.com>
Sun, 1 May 2011 09:56:39 +0000
(
02:56
-0700)
compiler/llvmGen/LlvmMangler.hs
patch
|
blob
|
history
diff --git
a/compiler/llvmGen/LlvmMangler.hs
b/compiler/llvmGen/LlvmMangler.hs
index
7b38ed8
..
ac187e0
100644
(file)
--- a/
compiler/llvmGen/LlvmMangler.hs
+++ b/
compiler/llvmGen/LlvmMangler.hs
@@
-29,7
+29,7
@@
jmpInst = B.pack "\n\tjmp"
infoLen, spFix, labelStart :: Int
infoLen = B.length infoSec
spFix = 4
infoLen, spFix, labelStart :: Int
infoLen = B.length infoSec
spFix = 4
-labelStart = B.length jmpInst + 1
+labelStart = B.length jmpInst
-- Search Predicates
eolPred, dollarPred, commaPred :: Char -> Bool
-- Search Predicates
eolPred, dollarPred, commaPred :: Char -> Bool
@@
-114,11
+114,13
@@
fixupStack f f' =
(a', n) = B.breakEnd dollarPred a
(n', x) = B.break commaPred n
num = B.pack $ show $ readInt n' + spFix
(a', n) = B.breakEnd dollarPred a
(n', x) = B.break commaPred n
num = B.pack $ show $ readInt n' + spFix
+ -- We need to avoid processing jumps to labels, they are of the form:
+ -- jmp\tL..., jmp\t_f..., jmpl\t_f..., jmpl\t*%eax..., jmpl *L...
+ targ = B.dropWhile ((==)'*') $ B.drop 1 $ B.dropWhile ((/=)'\t') $
+ B.drop labelStart c
in if B.null c
then f' `B.append` f
in if B.null c
then f' `B.append` f
- -- We need to avoid processing jumps to labels, they are of the form:
- -- jmp\tL..., jmp\t_f..., jmpl\t_f..., jmpl\t*%eax...
- else if B.index c labelStart == 'L'
+ else if B.head targ == 'L'
then fixupStack b $ f' `B.append` a `B.append` l
else fixupStack b $ f' `B.append` a' `B.append` num `B.append`
x `B.append` l
then fixupStack b $ f' `B.append` a `B.append` l
else fixupStack b $ f' `B.append` a' `B.append` num `B.append`
x `B.append` l