summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Gamari <bgamari.foss@gmail.com>2017-02-14 08:43:40 -0500
committerBen Gamari <ben@smart-cactus.org>2017-02-14 10:53:01 -0500
commit2d6e91eab9391210b8b816d9664407f246ef30e4 (patch)
treee9c0d1d3277ac05db0a2e6d526c09dd742d2ad46
parent20b5dfc2a203fb06ba1971f9623578f1e66540b7 (diff)
downloadhaskell-2d6e91eab9391210b8b816d9664407f246ef30e4.tar.gz
Debug: Use local symbols for unwind points (#13278)
While this apparently didn't matter on Linux, the OS X toolchain seems to treat local and external symbols differently during linking. Namely, the linker assumes that an external symbol marks the beginning of a new, unused procedure, and consequently drops it. Fixes regression introduced in D2741. Test Plan: `debug` testcase on OS X Reviewers: austin, simonmar, rwbarton Reviewed By: rwbarton Subscribers: rwbarton, thomie Differential Revision: https://phabricator.haskell.org/D3135
-rw-r--r--compiler/cmm/Debug.hs2
-rw-r--r--compiler/nativeGen/X86/CodeGen.hs5
-rw-r--r--compiler/nativeGen/X86/Instr.hs2
3 files changed, 5 insertions, 4 deletions
diff --git a/compiler/cmm/Debug.hs b/compiler/cmm/Debug.hs
index 79026949f6..428721a657 100644
--- a/compiler/cmm/Debug.hs
+++ b/compiler/cmm/Debug.hs
@@ -393,7 +393,7 @@ See also: Note [Unwinding information in the NCG] in AsmCodeGen.
-}
-- | A label associated with an 'UnwindTable'
-data UnwindPoint = UnwindPoint !Label !UnwindTable
+data UnwindPoint = UnwindPoint !CLabel !UnwindTable
instance Outputable UnwindPoint where
ppr (UnwindPoint lbl uws) =
diff --git a/compiler/nativeGen/X86/CodeGen.hs b/compiler/nativeGen/X86/CodeGen.hs
index a0a8f9d0be..72f8290057 100644
--- a/compiler/nativeGen/X86/CodeGen.hs
+++ b/compiler/nativeGen/X86/CodeGen.hs
@@ -68,6 +68,7 @@ import Unique
import FastString
import DynFlags
import Util
+import UniqSupply ( getUniqueM )
import Control.Monad
import Data.Bits
@@ -162,7 +163,7 @@ addSpUnwindings :: Instr -> NatM (OrdList Instr)
addSpUnwindings instr@(DELTA d) = do
dflags <- getDynFlags
if debugLevel dflags >= 1
- then do lbl <- newBlockId
+ then do lbl <- mkAsmTempLabel <$> getUniqueM
let unwind = M.singleton MachSp (Just $ UwReg MachSp $ negate d)
return $ toOL [ instr, UNWIND lbl unwind ]
else return (unitOL instr)
@@ -188,7 +189,7 @@ stmtToInstrs stmt = do
case foldMap to_unwind_entry regs of
tbl | M.null tbl -> return nilOL
| otherwise -> do
- lbl <- newBlockId
+ lbl <- mkAsmTempLabel <$> getUniqueM
return $ unitOL $ UNWIND lbl tbl
CmmAssign reg src
diff --git a/compiler/nativeGen/X86/Instr.hs b/compiler/nativeGen/X86/Instr.hs
index 4b43a1cf27..f4ac55c34f 100644
--- a/compiler/nativeGen/X86/Instr.hs
+++ b/compiler/nativeGen/X86/Instr.hs
@@ -182,7 +182,7 @@ data Instr
-- unwinding information
-- See Note [Unwinding information in the NCG].
- | UNWIND BlockId UnwindTable
+ | UNWIND CLabel UnwindTable
-- specify current stack offset for benefit of subsequent passes.
-- This carries a BlockId so it can be used in unwinding information.