summaryrefslogtreecommitdiff
path: root/compiler/nativeGen/SPARC
diff options
context:
space:
mode:
authorSimon Brenner <olsner@gmail.com>2016-01-27 11:05:35 +0100
committerBen Gamari <ben@smart-cactus.org>2016-01-27 11:32:15 +0100
commit0dc7b36c3c261b3eccf8460581fcd3d71f6e6ff6 (patch)
treec228cc1f2693ef539a599c0cd41b7640052ee7ea /compiler/nativeGen/SPARC
parent1c6130d91420dc835c281bc9b13d603b7aa49b59 (diff)
downloadhaskell-0dc7b36c3c261b3eccf8460581fcd3d71f6e6ff6.tar.gz
Restore original alignment for info tables
This was broken in 4a32bf925b8aba7885d9c745769fe84a10979a53, meaning that info tables and subsequent code are no longer guaranteed to have the recommended alignment. Split up the section header and section alignment printers, and print an appropriate alignment directive before each info table. Fixes Trac #11486 Reviewers: austin, bgamari, rwbarton Reviewed By: bgamari, rwbarton Subscribers: thomie Differential Revision: https://phabricator.haskell.org/D1847 GHC Trac Issues: #11486
Diffstat (limited to 'compiler/nativeGen/SPARC')
-rw-r--r--compiler/nativeGen/SPARC/Ppr.hs7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/nativeGen/SPARC/Ppr.hs b/compiler/nativeGen/SPARC/Ppr.hs
index 8c7871e059..eb41f2390f 100644
--- a/compiler/nativeGen/SPARC/Ppr.hs
+++ b/compiler/nativeGen/SPARC/Ppr.hs
@@ -96,7 +96,7 @@ pprBasicBlock info_env (BasicBlock blockid instrs)
maybe_infotable = case mapLookup blockid info_env of
Nothing -> empty
Just (Statics info_lbl info) ->
- pprSectionAlign (Section Text info_lbl) $$
+ pprAlignForSection Text $$
vcat (map pprData info) $$
pprLabel info_lbl
@@ -326,6 +326,11 @@ pprSectionAlign :: Section -> SDoc
pprSectionAlign sec@(Section seg _) =
sdocWithPlatform $ \platform ->
pprSectionHeader platform sec $$
+ pprAlignForSection seg
+
+-- | Print appropriate alignment for the given section type.
+pprAlignForSection :: SectionType -> SDoc
+pprAlignForSection seg =
ptext (case seg of
Text -> sLit ".align 4"
Data -> sLit ".align 8"