summaryrefslogtreecommitdiff
path: root/compiler/GHC/Utils/Asm.hs
diff options
context:
space:
mode:
Diffstat (limited to 'compiler/GHC/Utils/Asm.hs')
-rw-r--r--compiler/GHC/Utils/Asm.hs21
1 files changed, 21 insertions, 0 deletions
diff --git a/compiler/GHC/Utils/Asm.hs b/compiler/GHC/Utils/Asm.hs
new file mode 100644
index 0000000000..5b8b209f5e
--- /dev/null
+++ b/compiler/GHC/Utils/Asm.hs
@@ -0,0 +1,21 @@
+-- | Various utilities used in generating assembler.
+--
+-- These are used not only by the native code generator, but also by the
+-- GHC.Driver.Pipeline
+module GHC.Utils.Asm
+ ( sectionType
+ ) where
+
+import GHC.Prelude
+
+import GHC.Platform
+import GHC.Utils.Outputable
+
+-- | Generate a section type (e.g. @\@progbits@). See #13937.
+sectionType :: Platform -- ^ Target platform
+ -> String -- ^ section type
+ -> SDoc -- ^ pretty assembler fragment
+sectionType platform ty =
+ case platformArch platform of
+ ArchARM{} -> char '%' <> text ty
+ _ -> char '@' <> text ty