diff options
author | Ben Gamari <bgamari.foss@gmail.com> | 2017-07-11 15:41:55 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-07-11 16:32:43 -0400 |
commit | 9b9f978fdcd13ff7b2a9b7391e02dff06da622a0 (patch) | |
tree | 23221a07613b0866727026b201778eb5bc3d08b4 /compiler/nativeGen/Dwarf | |
parent | 4befb415d7ee63d2b0ecdc2384310dc4b3ccc90a (diff) | |
download | haskell-9b9f978fdcd13ff7b2a9b7391e02dff06da622a0.tar.gz |
Use correct section types syntax for architecture
Previously GHC would always assume that section types began with `@` while
producing assembly, which is not true. For instance, in ARM assembly syntax
section types begin with `%`. This abstracts out section type pretty-printing
and adjusts it to correctly account for the target architectures assembly
flavor.
Reviewers: austin, hvr, Phyx
Reviewed By: Phyx
Subscribers: Phyx, rwbarton, thomie, erikd
GHC Trac Issues: #13937
Differential Revision: https://phabricator.haskell.org/D3712
Diffstat (limited to 'compiler/nativeGen/Dwarf')
-rw-r--r-- | compiler/nativeGen/Dwarf/Constants.hs | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/compiler/nativeGen/Dwarf/Constants.hs b/compiler/nativeGen/Dwarf/Constants.hs index 880c7d77a0..a8034ef295 100644 --- a/compiler/nativeGen/Dwarf/Constants.hs +++ b/compiler/nativeGen/Dwarf/Constants.hs @@ -3,6 +3,7 @@ module Dwarf.Constants where +import AsmUtils import FastString import Platform import Outputable @@ -150,14 +151,15 @@ dwarfGhcSection = dwarfSection "ghc" dwarfARangesSection = dwarfSection "aranges" dwarfSection :: String -> SDoc -dwarfSection name = sdocWithPlatform $ \plat -> ftext $ mkFastString $ +dwarfSection name = sdocWithPlatform $ \plat -> case platformOS plat of os | osElfTarget os - -> "\t.section .debug_" ++ name ++ ",\"\",@progbits" + -> text "\t.section .debug_" <> text name <> text ",\"\"," + <> sectionType "progbits" | osMachOTarget os - -> "\t.section __DWARF,__debug_" ++ name ++ ",regular,debug" + -> text "\t.section __DWARF,__debug_" <> text name <> text ",regular,debug" | otherwise - -> "\t.section .debug_" ++ name ++ ",\"dr\"" + -> text "\t.section .debug_" <> text name <> text ",\"dr\"" -- * Dwarf section labels dwarfInfoLabel, dwarfAbbrevLabel, dwarfLineLabel, dwarfFrameLabel :: LitString |