summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/AsmCodeGen.lhs
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2012-08-24 11:42:21 +0100
committerSimon Marlow <marlowsd@gmail.com>2012-08-28 09:16:44 +0100
commitc0849d8c4dbdabc657860d383474ee1e638b7c5f (patch)
treedcb1fc18d399611fc23f7bf3f177c0c91161ab8e /compiler/nativeGen/AsmCodeGen.lhs
parent1d36d88a681575176d026d7002e40d0ce5c45281 (diff)
downloadhaskell-c0849d8c4dbdabc657860d383474ee1e638b7c5f.tar.gz
Fix -fPIC with the new code generator
The CmmBlocks inside CmmExprs were not getting the PIC treatment
Diffstat (limited to 'compiler/nativeGen/AsmCodeGen.lhs')
-rw-r--r--compiler/nativeGen/AsmCodeGen.lhs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.lhs b/compiler/nativeGen/AsmCodeGen.lhs
index e510070c01..65fc4e339c 100644
--- a/compiler/nativeGen/AsmCodeGen.lhs
+++ b/compiler/nativeGen/AsmCodeGen.lhs
@@ -980,6 +980,12 @@ cmmExprNative referenceKind expr = do
-> do args' <- mapM (cmmExprNative DataReference) args
return $ CmmMachOp mop args'
+ CmmLit (CmmBlock id)
+ -> cmmExprNative referenceKind (CmmLit (CmmLabel (infoTblLbl id)))
+ -- we must convert block Ids to CLabels here, because we
+ -- might have to do the PIC transformation. Hence we must
+ -- not modify BlockIds beyond this point.
+
CmmLit (CmmLabel lbl)
-> do
cmmMakeDynamicReference dflags addImportCmmOpt referenceKind lbl