fix compilation with llvm-3.3

This commit is contained in:
Jens Petersen 2013-06-25 16:56:39 +09:00
parent 7b74369001
commit 3c760a9a18
2 changed files with 55 additions and 1 deletions

View File

@ -0,0 +1,46 @@
commit db9b63105a541e4ad3f9c55e2cfadf716445ab87
Author: Geoffrey Mainland <gmainlan@microsoft.com>
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

View File

@ -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 <petersen@redhat.com> - 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 <petersen@redhat.com> - 7.6.3-13
- production perf -O2 build
- see release notes: