summaryrefslogtreecommitdiff
path: root/compiler/nativeGen
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2019-03-27 00:27:01 -0400
committerBen Gamari <ben@smart-cactus.org>2019-05-14 16:41:19 -0400
commite529c65eacf595006dd5358491d28c202d673732 (patch)
tree0498cb0a7023c491c240d64069e2442073e83d77 /compiler/nativeGen
parentf9e4ea401121572d799b9db56f24aa1abdf5edf8 (diff)
downloadhaskell-e529c65eacf595006dd5358491d28c202d673732.tar.gz
Remove all target-specific portions of Config.hs
1. If GHC is to be multi-target, these cannot be baked in at compile time. 2. Compile-time flags have a higher maintenance than run-time flags. 3. The old way makes build system implementation (various bootstrapping details) with the thing being built. E.g. GHC doesn't need to care about which integer library *will* be used---this is purely a crutch so the build system doesn't need to pass flags later when using that library. 4. Experience with cross compilation in Nixpkgs has shown things work nicer when compiler's can *optionally* delegate the bootstrapping the package manager. The package manager knows the entire end-goal build plan, and thus can make top-down decisions on bootstrapping. GHC can just worry about GHC, not even core library like base and ghc-prim!
Diffstat (limited to 'compiler/nativeGen')
-rw-r--r--compiler/nativeGen/AsmCodeGen.hs2
-rw-r--r--compiler/nativeGen/PIC.hs48
2 files changed, 25 insertions, 25 deletions
diff --git a/compiler/nativeGen/AsmCodeGen.hs b/compiler/nativeGen/AsmCodeGen.hs
index c78ea5fcb1..2d0bf30b5e 100644
--- a/compiler/nativeGen/AsmCodeGen.hs
+++ b/compiler/nativeGen/AsmCodeGen.hs
@@ -852,7 +852,7 @@ makeImportsDoc dflags imports
| otherwise
= Outputable.empty
- doPpr lbl = (lbl, renderWithStyle dflags (pprCLabel platform lbl) astyle)
+ doPpr lbl = (lbl, renderWithStyle dflags (pprCLabel dflags lbl) astyle)
astyle = mkCodeStyle AsmStyle
-- -----------------------------------------------------------------------------
diff --git a/compiler/nativeGen/PIC.hs b/compiler/nativeGen/PIC.hs
index b4bf8998d1..69113e8ea5 100644
--- a/compiler/nativeGen/PIC.hs
+++ b/compiler/nativeGen/PIC.hs
@@ -565,19 +565,19 @@ pprGotDeclaration _ _ _
--
pprImportedSymbol :: DynFlags -> Platform -> CLabel -> SDoc
-pprImportedSymbol dflags platform@(Platform { platformArch = ArchX86, platformOS = OSDarwin }) importedLbl
+pprImportedSymbol dflags (Platform { platformArch = ArchX86, platformOS = OSDarwin }) importedLbl
| Just (CodeStub, lbl) <- dynamicLinkerLabelInfo importedLbl
= case positionIndependent dflags of
False ->
vcat [
text ".symbol_stub",
- text "L" <> pprCLabel platform lbl <> ptext (sLit "$stub:"),
- text "\t.indirect_symbol" <+> pprCLabel platform lbl,
- text "\tjmp *L" <> pprCLabel platform lbl
+ text "L" <> pprCLabel dflags lbl <> ptext (sLit "$stub:"),
+ text "\t.indirect_symbol" <+> pprCLabel dflags lbl,
+ text "\tjmp *L" <> pprCLabel dflags lbl
<> text "$lazy_ptr",
- text "L" <> pprCLabel platform lbl
+ text "L" <> pprCLabel dflags lbl
<> text "$stub_binder:",
- text "\tpushl $L" <> pprCLabel platform lbl
+ text "\tpushl $L" <> pprCLabel dflags lbl
<> text "$lazy_ptr",
text "\tjmp dyld_stub_binding_helper"
]
@@ -585,16 +585,16 @@ pprImportedSymbol dflags platform@(Platform { platformArch = ArchX86, platformOS
vcat [
text ".section __TEXT,__picsymbolstub2,"
<> text "symbol_stubs,pure_instructions,25",
- text "L" <> pprCLabel platform lbl <> ptext (sLit "$stub:"),
- text "\t.indirect_symbol" <+> pprCLabel platform lbl,
+ text "L" <> pprCLabel dflags lbl <> ptext (sLit "$stub:"),
+ text "\t.indirect_symbol" <+> pprCLabel dflags lbl,
text "\tcall ___i686.get_pc_thunk.ax",
text "1:",
- text "\tmovl L" <> pprCLabel platform lbl
+ text "\tmovl L" <> pprCLabel dflags lbl
<> text "$lazy_ptr-1b(%eax),%edx",
text "\tjmp *%edx",
- text "L" <> pprCLabel platform lbl
+ text "L" <> pprCLabel dflags lbl
<> text "$stub_binder:",
- text "\tlea L" <> pprCLabel platform lbl
+ text "\tlea L" <> pprCLabel dflags lbl
<> text "$lazy_ptr-1b(%eax),%eax",
text "\tpushl %eax",
text "\tjmp dyld_stub_binding_helper"
@@ -602,16 +602,16 @@ pprImportedSymbol dflags platform@(Platform { platformArch = ArchX86, platformOS
$+$ vcat [ text ".section __DATA, __la_sym_ptr"
<> (if positionIndependent dflags then int 2 else int 3)
<> text ",lazy_symbol_pointers",
- text "L" <> pprCLabel platform lbl <> ptext (sLit "$lazy_ptr:"),
- text "\t.indirect_symbol" <+> pprCLabel platform lbl,
- text "\t.long L" <> pprCLabel platform lbl
+ text "L" <> pprCLabel dflags lbl <> ptext (sLit "$lazy_ptr:"),
+ text "\t.indirect_symbol" <+> pprCLabel dflags lbl,
+ text "\t.long L" <> pprCLabel dflags lbl
<> text "$stub_binder"]
| Just (SymbolPtr, lbl) <- dynamicLinkerLabelInfo importedLbl
= vcat [
text ".non_lazy_symbol_pointer",
- char 'L' <> pprCLabel platform lbl <> text "$non_lazy_ptr:",
- text "\t.indirect_symbol" <+> pprCLabel platform lbl,
+ char 'L' <> pprCLabel dflags lbl <> text "$non_lazy_ptr:",
+ text "\t.indirect_symbol" <+> pprCLabel dflags lbl,
text "\t.long\t0"]
| otherwise
@@ -632,12 +632,12 @@ pprImportedSymbol _ (Platform { platformOS = OSDarwin }) _
--
-- NB: No DSO-support yet
-pprImportedSymbol _ platform@(Platform { platformOS = OSAIX }) importedLbl
+pprImportedSymbol dflags (Platform { platformOS = OSAIX }) importedLbl
= case dynamicLinkerLabelInfo importedLbl of
Just (SymbolPtr, lbl)
-> vcat [
- text "LC.." <> pprCLabel platform lbl <> char ':',
- text "\t.long" <+> pprCLabel platform lbl ]
+ text "LC.." <> pprCLabel dflags lbl <> char ':',
+ text "\t.long" <+> pprCLabel dflags lbl ]
_ -> empty
-- ELF / Linux
@@ -669,15 +669,15 @@ pprImportedSymbol _ platform@(Platform { platformOS = OSAIX }) importedLbl
-- the NCG will keep track of all DynamicLinkerLabels it uses
-- and output each of them using pprImportedSymbol.
-pprImportedSymbol _ platform@(Platform { platformArch = ArchPPC_64 _ })
+pprImportedSymbol dflags platform@(Platform { platformArch = ArchPPC_64 _ })
importedLbl
| osElfTarget (platformOS platform)
= case dynamicLinkerLabelInfo importedLbl of
Just (SymbolPtr, lbl)
-> vcat [
text ".section \".toc\", \"aw\"",
- text ".LC_" <> pprCLabel platform lbl <> char ':',
- text "\t.quad" <+> pprCLabel platform lbl ]
+ text ".LC_" <> pprCLabel dflags lbl <> char ':',
+ text "\t.quad" <+> pprCLabel dflags lbl ]
_ -> empty
pprImportedSymbol dflags platform importedLbl
@@ -691,8 +691,8 @@ pprImportedSymbol dflags platform importedLbl
in vcat [
text ".section \".got2\", \"aw\"",
- text ".LC_" <> pprCLabel platform lbl <> char ':',
- ptext symbolSize <+> pprCLabel platform lbl ]
+ text ".LC_" <> pprCLabel dflags lbl <> char ':',
+ ptext symbolSize <+> pprCLabel dflags lbl ]
-- PLT code stubs are generated automatically by the dynamic linker.
_ -> empty