- (_, ldata) = resolveLlvmData dflags initLlvmEnv unres
- in pprLlvmData dflags ldata
+ (_, (ldata, ltypes)) = resolveLlvmData dflags env unres
+
+ setSection (gv@(LMGlobalVar s ty l _ _), d)
+ = let v = if l == Internal then [gv] else []
+ sec = mkLayoutSection count
+ in ((LMGlobalVar s ty l sec llvmInfAlign, d), v)
+ setSection v = (v,[])
+
+ (ldata', llvmUsed) = mapAndUnzip setSection ldata
+ in (pprLlvmData dflags (ldata', ltypes), concat llvmUsed)
+
+
+-- | Create an appropriate section declaration for subsection <n> of text
+-- WARNING: This technique could fail as gas documentation says it only
+-- supports up to 8192 subsections per section. Inspection of the source
+-- code and some test programs seem to suggest it supports more than this
+-- so we are hoping it does.
+mkLayoutSection :: Int -> LMSection
+mkLayoutSection n
+ = Just (fsLit $ ".text;.text " ++ show n ++ " #")