Commit 2d6e91ea authored by Ben Gamari's avatar Ben Gamari Committed by Ben Gamari
Browse files

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:
parent 20b5dfc2
......@@ -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) =
......@@ -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
......@@ -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.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment