diff options
author | GHC GitLab CI <ghc-ci@gitlab-haskell.org> | 2021-06-21 10:33:55 -0400 |
---|---|---|
committer | GHC GitLab CI <ghc-ci@gitlab-haskell.org> | 2021-06-21 11:12:05 -0400 |
commit | c4b75c997ec8e7d5842d65cd75d9e2af9c8aa8b3 (patch) | |
tree | 5ef7c22e98d340cd4542bb10d32948002b183917 | |
parent | 8609bbd8bc6538452cac0b7ca03caebbd82c9e3a (diff) | |
download | haskell-wip/T16780.tar.gz |
XXX: nativeGen: Don't assume small code modelwip/T16780
As noted in #16780, we previously assumed that all labels lived in the
bottom 2GB of address space, which was safe since we assumed a small
code model.
-rw-r--r-- | compiler/GHC/CmmToAsm/X86/CodeGen.hs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/compiler/GHC/CmmToAsm/X86/CodeGen.hs b/compiler/GHC/CmmToAsm/X86/CodeGen.hs index 2cce508a00..a51ab120af 100644 --- a/compiler/GHC/CmmToAsm/X86/CodeGen.hs +++ b/compiler/GHC/CmmToAsm/X86/CodeGen.hs @@ -1530,17 +1530,19 @@ getRegOrMem e = do (reg, code) <- getNonClobberedReg e return (OpReg reg, code) +-- | FIXME +smallMemoryModel :: Bool +smallMemoryModel = False + is32BitLit :: Bool -> CmmLit -> Bool is32BitLit is32Bit lit | not is32Bit = case lit of CmmInt i W64 -> is32BitInteger i - -- assume that labels are in the range 0-2^31-1: this assumes the - -- small memory model (see gcc docs, -mcmodel=small). - CmmLabel _ -> True + CmmLabel _ -> smallMemoryModel -- however we can't assume that label offsets are in this range -- (see #15570) - CmmLabelOff _ off -> is32BitInteger (fromIntegral off) - CmmLabelDiffOff _ _ off _ -> is32BitInteger (fromIntegral off) + CmmLabelOff _ off -> smallMemoryModel && is32BitInteger (fromIntegral off) + CmmLabelDiffOff _ _ off _ -> smallMemoryModel && is32BitInteger (fromIntegral off) _ -> True is32BitLit _ _ = True |