summaryrefslogtreecommitdiff
path: root/compiler/main/DriverPipeline.hs
diff options
context:
space:
mode:
authorÖmer Sinan Ağacan <omeragacan@gmail.com>2019-08-23 14:43:11 +0300
committerBen Gamari <ben@well-typed.com>2019-10-22 15:16:00 -0400
commite4ee13d0c9b7b50c64e5ccf004b15c253ebfb28c (patch)
tree04d4a9691712779c8a234636dd6d20dd8de5bd98 /compiler/main/DriverPipeline.hs
parent41e75bbb010574881a6f34a43a82a03d23c12c59 (diff)
downloadhaskell-wip/backport-T16912.tar.gz
Fix LLVM version check yet againwip/backport-T16912
There were two problems with LLVM version checking: - The parser would only parse x and x.y formatted versions. E.g. 1.2.3 would be rejected. - The version check was too strict and would reject x.y formatted versions. E.g. when we support version 7 it'd reject 7.0 ("LLVM version 7.0") and only accept 7 ("LLVM version 7"). We now parse versions with arbitrarily deep minor numbering (x.y.z.t...) and accept versions as long as the major version matches the supported version (e.g. 7.1, 7.1.2, 7.1.2.3 ...). (cherry picked from commit bf9dfe1ca32270f5e946e0f8ac1bb97184de6e4c)
Diffstat (limited to 'compiler/main/DriverPipeline.hs')
-rw-r--r--compiler/main/DriverPipeline.hs10
1 files changed, 5 insertions, 5 deletions
diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index ef6152430d..bf79ea5d02 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -56,7 +56,7 @@ import StringBuffer ( hGetStringBuffer, hPutStringBuffer )
import BasicTypes ( SuccessFlag(..) )
import Maybes ( expectJust )
import SrcLoc
-import LlvmCodeGen ( LlvmVersion (..), llvmFixupAsm )
+import LlvmCodeGen ( llvmFixupAsm, llvmVersionList )
import MonadUtils
import Platform
import TcRnTypes
@@ -2170,10 +2170,10 @@ doCpp dflags raw input_fn output_fn = do
getBackendDefs :: DynFlags -> IO [String]
getBackendDefs dflags | hscTarget dflags == HscLlvm = do
llvmVer <- figureLlvmVersion dflags
- return $ case llvmVer of
- Just (LlvmVersion n) -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (n,0) ]
- Just (LlvmVersionOld m n) -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m,n) ]
- _ -> []
+ return $ case fmap llvmVersionList llvmVer of
+ Just [m] -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m,0) ]
+ Just (m:n:_) -> [ "-D__GLASGOW_HASKELL_LLVM__=" ++ format (m,n) ]
+ _ -> []
where
format (major, minor)
| minor >= 100 = error "getBackendDefs: Unsupported minor version"