Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Glasgow Haskell Compiler
GHC
Commits
e82e703e
Commit
e82e703e
authored
May 01, 2011
by
dterei
Browse files
LLVM: Fix bug with osx mangler and jump tables.
parent
50f5c849
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/llvmGen/LlvmMangler.hs
View file @
e82e703e
...
...
@@ -29,7 +29,7 @@ jmpInst = B.pack "\n\tjmp"
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
...
...
@@ -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
-- 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
-- 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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment