summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/AsmCodeGen.hs
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2018-11-26 17:21:12 -0500
committerBen Gamari <ben@smart-cactus.org>2018-11-27 14:25:03 -0500
commit730ac880c5dc23e0f32a2f08d89d4e5d2a583512 (patch)
treeaa85ded8d0edd3d465963c8b3870b8270628ae30 /compiler/nativeGen/AsmCodeGen.hs
parentdf570d920fa66db631f936fa377e598fe92bd2a1 (diff)
downloadhaskell-wip/kill-obj-splitter.tar.gz
Rip out object splittingwip/kill-obj-splitter
The splitter is an evil Perl script that processes assembler code. Its job can be done better by the linker's --gc-sections flag. GHC passes this flag to the linker whenever -split-sections is passed on the command line. This is based on @DemiMarie's D2768. Fixes Trac #11315 Fixes Trac #9832 Fixes Trac #8964 Fixes Trac #8685 Fixes Trac #8629
Diffstat (limited to 'compiler/nativeGen/AsmCodeGen.hs')
-rw-r--r--compiler/nativeGen/AsmCodeGen.hs32
1 files changed, 7 insertions, 25 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs
index 956528bf81..07cc112ef9 100644
--- a/compiler/nativeGen/AsmCodeGen.hs
+++ b/compiler/nativeGen/AsmCodeGen.hs
@@ -335,7 +335,7 @@ finishNativeGen :: Instruction instr
finishNativeGen dflags modLoc bufh@(BufHandle _ _ h) us ngs
= do
-- Write debug data and finish
- let emitDw = debugLevel dflags > 0 && not (gopt Opt_SplitObjs dflags)
+ let emitDw = debugLevel dflags > 0
us' <- if not emitDw then return us else do
(dwarf, us') <- dwarfGen dflags modLoc us (ngs_debug ngs)
emitNativeCode dflags bufh dwarf
@@ -406,14 +406,9 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs
| otherwise = []
dbgMap = debugToMap ndbgs
- -- Insert split marker, generate native code
- let splitObjs = gopt Opt_SplitObjs dflags
- split_marker = CmmProc mapEmpty mkSplitMarkerLabel [] $
- ofBlockList (panic "split_marker_entry") []
- cmms' | splitObjs = split_marker : cmms
- | otherwise = cmms
+ -- Generate native code
(ngs',us') <- cmmNativeGens dflags this_mod modLoc ncgImpl h
- dbgMap us cmms' ngs 0
+ dbgMap us cmms ngs 0
-- Link native code information into debug blocks
-- See Note [What is this unwinding business?] in Debug.
@@ -421,23 +416,10 @@ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us cmm_stream ngs
dumpIfSet_dyn dflags Opt_D_dump_debug "Debug Infos"
(vcat $ map ppr ldbgs)
- -- Emit & clear DWARF information when generating split
- -- object files, as we need it to land in the same object file
- -- When using split sections, note that we do not split the debug
- -- info but emit all the info at once in finishNativeGen.
- (ngs'', us'') <-
- if debugFlag && splitObjs
- then do (dwarf, us'') <- dwarfGen dflags modLoc us ldbgs
- emitNativeCode dflags h dwarf
- return (ngs' { ngs_debug = []
- , ngs_dwarfFiles = emptyUFM
- , ngs_labels = [] },
- us'')
- else return (ngs' { ngs_debug = ngs_debug ngs' ++ ldbgs
- , ngs_labels = [] },
- us')
-
- cmmNativeGenStream dflags this_mod modLoc ncgImpl h us''
+ -- Accumulate debug information for emission in finishNativeGen.
+ let ngs'' = ngs' { ngs_debug = ngs_debug ngs' ++ ldbgs, ngs_labels = [] }
+
+ cmmNativeGenStream dflags this_mod modLoc ncgImpl h us'
cmm_stream' ngs''
-- | Do native code generation on all these cmms.