From 5a78a2efb54d2390c8f75448f7e0760b516fe452 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Tue, 25 Jun 2013 16:56:39 +0900 Subject: [PATCH] fix compilation with llvm-3.3 --- ghc-llvmCodeGen-empty-array.patch | 46 +++++++++++++++++++++++++++++++ ghc.spec | 10 ++++++- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 ghc-llvmCodeGen-empty-array.patch diff --git a/ghc-llvmCodeGen-empty-array.patch b/ghc-llvmCodeGen-empty-array.patch new file mode 100644 index 0000000..5dc3e96 --- /dev/null +++ b/ghc-llvmCodeGen-empty-array.patch @@ -0,0 +1,46 @@ +commit db9b63105a541e4ad3f9c55e2cfadf716445ab87 +Author: Geoffrey Mainland +Date: Wed Jun 12 14:31:49 2013 +0100 + + Avoid generating empty llvm.used definitions. + + LLVM 3.3rc3 complains when the llvm.used global is an empty array, so don't + define llvm.used at all when it would be empty. + + Modified compiler/llvmGen/LlvmCodeGen.hs +diff --git a/compiler/llvmGen/LlvmCodeGen.hs b/compiler/llvmGen/LlvmCodeGen.hs +index a157a25..4f2bded 100644 +--- a/compiler/llvmGen/LlvmCodeGen.hs ++++ b/compiler/llvmGen/LlvmCodeGen.hs +@@ -117,19 +117,19 @@ cmmProcLlvmGens :: DynFlags -> BufHandle -> UniqSupply -> LlvmEnv -> [RawCmmDecl + -> [[LlvmVar]] -- ^ info tables that need to be marked as 'used' + -> IO () + +-cmmProcLlvmGens _ _ _ _ [] _ [] +- = return () +- + cmmProcLlvmGens dflags h _ _ [] _ ivars +- = let ivars' = concat ivars +- cast x = LMBitc (LMStaticPointer (pVarLift x)) i8Ptr +- ty = (LMArray (length ivars') i8Ptr) +- usedArray = LMStaticArray (map cast ivars') ty +- lmUsed = (LMGlobalVar (fsLit "llvm.used") ty Appending +- (Just $ fsLit "llvm.metadata") Nothing False, Just usedArray) +- in Prt.bufLeftRender h $ {-# SCC "llvm_used_ppr" #-} +- withPprStyleDoc dflags (mkCodeStyle CStyle) $ +- pprLlvmData ([lmUsed], []) ++ | null ivars' = return () ++ | otherwise = Prt.bufLeftRender h $ ++ {-# SCC "llvm_used_ppr" #-} ++ withPprStyleDoc dflags (mkCodeStyle CStyle) $ ++ pprLlvmData ([lmUsed], []) ++ where ++ ivars' = concat ivars ++ cast x = LMBitc (LMStaticPointer (pVarLift x)) i8Ptr ++ ty = (LMArray (length ivars') i8Ptr) ++ usedArray = LMStaticArray (map cast ivars') ty ++ lmUsed = (LMGlobalVar (fsLit "llvm.used") ty Appending ++ (Just $ fsLit "llvm.metadata") Nothing False, Just usedArray) + + cmmProcLlvmGens dflags h us env ((CmmData _ _) : cmms) count ivars + = cmmProcLlvmGens dflags h us env cmms count ivars diff --git a/ghc.spec b/ghc.spec index de61d3d..3951741 100644 --- a/ghc.spec +++ b/ghc.spec @@ -29,7 +29,7 @@ Version: 7.6.3 # - release can only be reset if *all* library versions get bumped simultaneously # (sometimes after a major release) # - minor release numbers for a branch should be incremented monotonically -Release: 13%{?dist} +Release: 14%{?dist} Summary: Glasgow Haskell Compiler License: %BSDHaskellReport @@ -50,6 +50,8 @@ Patch9: Cabal-fix-dynamic-exec-for-TH.patch Patch10: ghc-wrapper-libffi-include.patch # disable building HS*.o libs for ghci Patch12: ghc-7.4.2-Cabal-disable-ghci-libs.patch +# fix compilation with llvm-3.3 +Patch13: ghc-llvmCodeGen-empty-array.patch # fedora ghc has been bootstrapped on # %{ix86} x86_64 ppc alpha sparcv9 ppc64 armv7hl armv5tel s390 s390x @@ -223,6 +225,8 @@ ln -s $(pkg-config --variable=includedir libffi)/*.h rts/dist/build %patch12 -p1 -b .orig +%patch13 -p1 -b .orig + %build # http://hackage.haskell.org/trac/ghc/wiki/Platforms @@ -435,6 +439,10 @@ fi %changelog +* Tue Jun 25 2013 Jens Petersen - 7.6.3-14 +- fix compilation with llvm-3.3 (#977652) + see http://hackage.haskell.org/trac/ghc/ticket/7996 + * Thu Jun 20 2013 Jens Petersen - 7.6.3-13 - production perf -O2 build - see release notes: