summaryrefslogtreecommitdiff
path: root/compiler/llvmGen/LlvmCodeGen
diff options
context:
space:
mode:
authorTamar Christina <tamar@zhox.com>2017-03-26 19:05:46 +0100
committerTamar Christina <tamar@zhox.com>2017-07-08 00:02:36 +0100
commitbd4fdc6aa34a85268f3e9a2bd3f4142a97724ce4 (patch)
tree984a144a47f4045b226a1511442bb13fd3a8a3cb /compiler/llvmGen/LlvmCodeGen
parent99adcc8804e91161b35ff1d0e5f718d18fcaa66a (diff)
downloadhaskell-bd4fdc6aa34a85268f3e9a2bd3f4142a97724ce4.tar.gz
Implement split-sections support for windows.
Summary: Initial implementation of split-section on Windows. This also corrects section namings and uses the platform convention of `$` instead of `.` to separate sections. Implementation is based on @awson's patches to binutils. Binutils requires some extra help when compiling the libraries for GHCi usage. We drop the `-T` and use implicit scripts to amend the linker scripts instead of replacing it. Because of these very large GHCi object files, we need big-obj support, which will be added by another patch. Test Plan: ./validate Reviewers: awson, austin, bgamari Subscribers: dfeuer, rwbarton, thomie, snowleopard, #ghc_windows_task_force GHC Trac Issues: #12913 Differential Revision: https://phabricator.haskell.org/D3383
Diffstat (limited to 'compiler/llvmGen/LlvmCodeGen')
-rw-r--r--compiler/llvmGen/LlvmCodeGen/Data.hs20
1 files changed, 15 insertions, 5 deletions
diff --git a/compiler/llvmGen/LlvmCodeGen/Data.hs b/compiler/llvmGen/LlvmCodeGen/Data.hs
index adb86d312d..39abbd1ac0 100644
--- a/compiler/llvmGen/LlvmCodeGen/Data.hs
+++ b/compiler/llvmGen/LlvmCodeGen/Data.hs
@@ -60,13 +60,19 @@ genLlvmData (sec, Statics lbl xs) = do
llvmSectionType :: Platform -> SectionType -> FastString
llvmSectionType p t = case t of
Text -> fsLit ".text"
- ReadOnlyData -> fsLit ".rodata"
- RelocatableReadOnlyData -> fsLit ".data.rel.ro"
- ReadOnlyData16 -> fsLit ".rodata.cst16"
+ ReadOnlyData -> case platformOS p of
+ OSMinGW32 -> fsLit ".rdata"
+ _ -> fsLit ".rodata"
+ RelocatableReadOnlyData -> case platformOS p of
+ OSMinGW32 -> fsLit ".rdata$rel.ro"
+ _ -> fsLit ".data.rel.ro"
+ ReadOnlyData16 -> case platformOS p of
+ OSMinGW32 -> fsLit ".rdata$cst16"
+ _ -> fsLit ".rodata.cst16"
Data -> fsLit ".data"
UninitialisedData -> fsLit ".bss"
CString -> case platformOS p of
- OSMinGW32 -> fsLit ".rdata"
+ OSMinGW32 -> fsLit ".rdata$str"
_ -> fsLit ".rodata.str"
(OtherSection _) -> panic "llvmSectionType: unknown section type"
@@ -80,7 +86,11 @@ llvmSection (Section t suffix) = do
then return Nothing
else do
lmsuffix <- strCLabel_llvm suffix
- return (Just (concatFS [llvmSectionType platform t, fsLit ".", lmsuffix]))
+ let result sep = Just (concatFS [llvmSectionType platform t
+ , fsLit sep, lmsuffix])
+ case platformOS platform of
+ OSMinGW32 -> return (result "$")
+ _ -> return (result ".")
-- ----------------------------------------------------------------------------
-- * Generate static data