[commit: ghc] ghc-8.2: DWARF: Use .short to render half-machine-words (bed2ff7)

git at git.haskell.org git at git.haskell.org
Mon Jun 26 22:25:37 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : ghc-8.2
Link       : http://ghc.haskell.org/trac/ghc/changeset/bed2ff7f26319d7ee4c5be0ee66c48e13c08a1a5/ghc

>---------------------------------------------------------------

commit bed2ff7f26319d7ee4c5be0ee66c48e13c08a1a5
Author: Ben Gamari <bgamari.foss at gmail.com>
Date:   Mon Jun 26 16:27:11 2017 -0400

    DWARF: Use .short to render half-machine-words
    
    The binutils documentation states that .short is a synonym for .word,
    which I assumed to mean "machine word", leading me to believe that we
    needed to use .hword to render half-machine-words. However, Darwin's
    toolchain doesn't understand .hword, so there we instead used .short.
    
    However, as it turns out the binutils documentation confusingly uses
    "word" to refer to a 16-bit word, so .short should work fine. Moreover,
    LLVM's internal assembler also doesn't understand .hword, so using
    .short consistently simplies things remarkably.
    
    Test Plan: Validate using binutils and LLVM internal assembler,
    validate on Darwin
    
    Reviewers: niteria, austin
    
    Reviewed By: niteria
    
    Subscribers: rwbarton, thomie
    
    GHC Trac Issues: #13866
    
    Differential Revision: https://phabricator.haskell.org/D3667
    
    (cherry picked from commit 904255eb9b537103898fb5f6b73df9b53ca7fd93)


>---------------------------------------------------------------

bed2ff7f26319d7ee4c5be0ee66c48e13c08a1a5
 compiler/nativeGen/Dwarf/Types.hs | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/compiler/nativeGen/Dwarf/Types.hs b/compiler/nativeGen/Dwarf/Types.hs
index d4d8e24..e799f43 100644
--- a/compiler/nativeGen/Dwarf/Types.hs
+++ b/compiler/nativeGen/Dwarf/Types.hs
@@ -516,14 +516,7 @@ pprByte x = text "\t.byte " <> ppr (fromIntegral x :: Word)
 
 -- | Assembly for a two-byte constant integer
 pprHalf :: Word16 -> SDoc
-pprHalf x = sdocWithPlatform $ \plat ->
-  -- Naturally Darwin doesn't support `.hword` and binutils uses `.short`
-  -- as a synonym for `.word` (but only some of the time!). The madness
-  -- is nearly too much to bear.
-  let dir = case platformOS plat of
-        OSDarwin -> text ".short"
-        _        -> text ".hword"
-  in text "\t" <> dir <+> ppr (fromIntegral x :: Word)
+pprHalf x = text "\t.short" <+> ppr (fromIntegral x :: Word)
 
 -- | Assembly for a constant DWARF flag
 pprFlag :: Bool -> SDoc



More information about the ghc-commits mailing list