Commit db9b6310 authored by gmainlan@microsoft.com's avatar gmainlan@microsoft.com
Browse files

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.
parent 289be612
...@@ -117,19 +117,19 @@ cmmProcLlvmGens :: DynFlags -> BufHandle -> UniqSupply -> LlvmEnv -> [RawCmmDecl ...@@ -117,19 +117,19 @@ cmmProcLlvmGens :: DynFlags -> BufHandle -> UniqSupply -> LlvmEnv -> [RawCmmDecl
-> [[LlvmVar]] -- ^ info tables that need to be marked as 'used' -> [[LlvmVar]] -- ^ info tables that need to be marked as 'used'
-> IO () -> IO ()
cmmProcLlvmGens _ _ _ _ [] _ []
= return ()
cmmProcLlvmGens dflags h _ _ [] _ ivars cmmProcLlvmGens dflags h _ _ [] _ ivars
= let ivars' = concat ivars | null ivars' = return ()
cast x = LMBitc (LMStaticPointer (pVarLift x)) i8Ptr | otherwise = Prt.bufLeftRender h $
ty = (LMArray (length ivars') i8Ptr) {-# SCC "llvm_used_ppr" #-}
usedArray = LMStaticArray (map cast ivars') ty withPprStyleDoc dflags (mkCodeStyle CStyle) $
lmUsed = (LMGlobalVar (fsLit "llvm.used") ty Appending pprLlvmData ([lmUsed], [])
(Just $ fsLit "llvm.metadata") Nothing False, Just usedArray) where
in Prt.bufLeftRender h $ {-# SCC "llvm_used_ppr" #-} ivars' = concat ivars
withPprStyleDoc dflags (mkCodeStyle CStyle) $ cast x = LMBitc (LMStaticPointer (pVarLift x)) i8Ptr
pprLlvmData ([lmUsed], []) 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 ((CmmData _ _) : cmms) count ivars
= cmmProcLlvmGens dflags h us env cmms count ivars = cmmProcLlvmGens dflags h us env cmms count ivars
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment