diff options
-rw-r--r-- | compiler/main/DriverPipeline.hs | 6 | ||||
-rw-r--r-- | docs/users_guide/8.0.2-notes.rst | 6 | ||||
-rw-r--r-- | docs/users_guide/phases.rst | 4 |
3 files changed, 14 insertions, 2 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs index 5d648e60f9..6e61d20dc8 100644 --- a/compiler/main/DriverPipeline.hs +++ b/compiler/main/DriverPipeline.hs @@ -2099,8 +2099,12 @@ getBackendDefs :: DynFlags -> IO [String] getBackendDefs dflags | hscTarget dflags == HscLlvm = do llvmVer <- figureLlvmVersion dflags return $ case llvmVer of - Just n -> [ "-D__GLASGOW_HASKELL_LLVM__="++show n ] + Just n -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format n ] _ -> [] + where + format (major, minor) + | minor >= 100 = error "getBackendDefs: Unsupported minor version" + | otherwise = show $ (100 * major + minor :: Int) -- Contract is Int getBackendDefs _ = return [] diff --git a/docs/users_guide/8.0.2-notes.rst b/docs/users_guide/8.0.2-notes.rst index 43c956209a..82c214e534 100644 --- a/docs/users_guide/8.0.2-notes.rst +++ b/docs/users_guide/8.0.2-notes.rst @@ -40,6 +40,12 @@ Compiler defaulting to decimal, hexadecimal if the address starts with `0x`, and octal if the address starts with `0`. +- Due to an oversight in GHC 8.0.1, the value of the preprocessor macro + ``__GLASGOW_HASKELL_LLVM__``, which exposes the LLVM version used by GHC, was + no longer an integer. This value is now turned into an integer again, but the + formatting is changed to be in line with ``__GLASGOW_HASKELL__`` + (:ghc-ticket:`12628`). + Runtime system ~~~~~~~~~~~~~~ diff --git a/docs/users_guide/phases.rst b/docs/users_guide/phases.rst index 0c3b59f54c..01c2e1f35f 100644 --- a/docs/users_guide/phases.rst +++ b/docs/users_guide/phases.rst @@ -291,7 +291,9 @@ defined by your local GHC installation, the following trick is useful: Only defined when ``-fllvm`` is specified. When GHC is using version ``x.y.z`` of LLVM, the value of ``__GLASGOW_HASKELL_LLVM__`` is the - integer ⟨xy⟩. + integer ⟨xyy⟩ (if ⟨y⟩ is a single digit, then a leading zero + is added, so for example when using version 3.7 of LLVM, + ``__GLASGOW_HASKELL_LLVM__==307``). ``__PARALLEL_HASKELL__`` .. index:: |