Accepting request 324452 from devel:languages:haskell

1

OBS-URL: https://build.opensuse.org/request/show/324452
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ghc?expand=0&rev=31
This commit is contained in:
Stephan Kulow 2015-08-23 13:43:31 +00:00 committed by Git OBS Bridge
commit 6adf9f27c3
14 changed files with 332 additions and 1384 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,293 +0,0 @@
Index: ghc-7.8.4/compiler/ghci/Linker.lhs
===================================================================
--- ghc-7.8.4.orig/compiler/ghci/Linker.lhs
+++ ghc-7.8.4/compiler/ghci/Linker.lhs
@@ -123,7 +123,10 @@ data PersistentLinkerState
-- The currently-loaded packages; always object code
-- Held, as usual, in dependency order; though I am not sure if
-- that is really important
- pkgs_loaded :: ![PackageId]
+ pkgs_loaded :: ![PackageId],
+ -- we need to remember the name of the last temporary DLL/.so
+ -- so we can link it
+ last_temp_so :: !(Maybe FilePath)
}
emptyPLS :: DynFlags -> PersistentLinkerState
@@ -132,7 +135,8 @@ emptyPLS _ = PersistentLinkerState {
itbl_env = emptyNameEnv,
pkgs_loaded = init_pkgs,
bcos_loaded = [],
- objs_loaded = [] }
+ objs_loaded = [],
+ last_temp_so = Nothing }
-- Packages that don't need loading, because the compiler
-- shares them with the interpreted program.
@@ -314,14 +318,15 @@ reallyInitDynLinker dflags =
; if null cmdline_lib_specs then return pls
else do
- { mapM_ (preloadLib dflags lib_paths framework_paths) cmdline_lib_specs
+ { pls1 <- foldM (preloadLib dflags lib_paths framework_paths) pls
+ cmdline_lib_specs
; maybePutStr dflags "final link ... "
; ok <- resolveObjs
; if succeeded ok then maybePutStrLn dflags "done"
else throwGhcExceptionIO (ProgramError "linking extra libraries/objects failed")
- ; return pls
+ ; return pls1
}}
@@ -360,19 +365,22 @@ classifyLdInput dflags f
return Nothing
where platform = targetPlatform dflags
-preloadLib :: DynFlags -> [String] -> [String] -> LibrarySpec -> IO ()
-preloadLib dflags lib_paths framework_paths lib_spec
+preloadLib :: DynFlags -> [String] -> [String] -> PersistentLinkerState
+ -> LibrarySpec -> IO (PersistentLinkerState)
+preloadLib dflags lib_paths framework_paths pls lib_spec
= do maybePutStr dflags ("Loading object " ++ showLS lib_spec ++ " ... ")
case lib_spec of
Object static_ish
- -> do b <- preload_static lib_paths static_ish
+ -> do (b, pls1) <- preload_static lib_paths static_ish
maybePutStrLn dflags (if b then "done"
else "not found")
+ return pls1
Archive static_ish
-> do b <- preload_static_archive lib_paths static_ish
maybePutStrLn dflags (if b then "done"
else "not found")
+ return pls
DLL dll_unadorned
-> do maybe_errstr <- loadDLL (mkSOName platform dll_unadorned)
@@ -388,12 +396,14 @@ preloadLib dflags lib_paths framework_pa
case err2 of
Nothing -> maybePutStrLn dflags "done"
Just _ -> preloadFailed mm lib_paths lib_spec
+ return pls
DLLPath dll_path
-> do maybe_errstr <- loadDLL dll_path
case maybe_errstr of
Nothing -> maybePutStrLn dflags "done"
Just mm -> preloadFailed mm lib_paths lib_spec
+ return pls
Framework framework ->
if platformUsesFrameworks (targetPlatform dflags)
@@ -401,6 +411,7 @@ preloadLib dflags lib_paths framework_pa
case maybe_errstr of
Nothing -> maybePutStrLn dflags "done"
Just mm -> preloadFailed mm framework_paths lib_spec
+ return pls
else panic "preloadLib Framework"
where
@@ -420,11 +431,13 @@ preloadLib dflags lib_paths framework_pa
-- Not interested in the paths in the static case.
preload_static _paths name
= do b <- doesFileExist name
- if not b then return False
- else do if dynamicGhc
- then dynLoadObjs dflags [name]
- else loadObj name
- return True
+ if not b then return (False, pls)
+ else if dynamicGhc
+ then do pls1 <- dynLoadObjs dflags pls [name]
+ return (True, pls1)
+ else do loadObj name
+ return (True, pls)
+
preload_static_archive _paths name
= do b <- doesFileExist name
if not b then return False
@@ -791,8 +804,8 @@ dynLinkObjs dflags pls objs = do
wanted_objs = map nameOfObject unlinkeds
if dynamicGhc
- then do dynLoadObjs dflags wanted_objs
- return (pls1, Succeeded)
+ then do pls2 <- dynLoadObjs dflags pls1 wanted_objs
+ return (pls2, Succeeded)
else do mapM_ loadObj wanted_objs
-- Link them all together
@@ -806,9 +819,11 @@ dynLinkObjs dflags pls objs = do
pls2 <- unload_wkr dflags [] pls1
return (pls2, Failed)
-dynLoadObjs :: DynFlags -> [FilePath] -> IO ()
-dynLoadObjs _ [] = return ()
-dynLoadObjs dflags objs = do
+
+dynLoadObjs :: DynFlags -> PersistentLinkerState -> [FilePath]
+ -> IO PersistentLinkerState
+dynLoadObjs _ pls [] = return pls
+dynLoadObjs dflags pls objs = do
let platform = targetPlatform dflags
soFile <- newTempName dflags (soExt platform)
let -- When running TH for a non-dynamic way, we still need to make
@@ -816,10 +831,22 @@ dynLoadObjs dflags objs = do
-- Opt_Static off
dflags1 = gopt_unset dflags Opt_Static
dflags2 = dflags1 {
- -- We don't want to link the ldInputs in; we'll
- -- be calling dynLoadObjs with any objects that
- -- need to be linked.
- ldInputs = [],
+ -- We don't want the original ldInputs in
+ -- (they're already linked in), but we do want
+ -- to link against the previous dynLoadObjs
+ -- library if there was one, so that the linker
+ -- can resolve dependencies when it loads this
+ -- library.
+ ldInputs =
+ case last_temp_so pls of
+ Nothing -> []
+ Just so ->
+ let (lp, l) = splitFileName so in
+ [ Option ("-L" ++ lp)
+ , Option ("-Wl,-rpath")
+ , Option ("-Wl," ++ lp)
+ , Option ("-l:" ++ l)
+ ],
-- Even if we're e.g. profiling, we still want
-- the vanilla dynamic libraries, so we set the
-- ways / build tag to be just WayDyn.
@@ -831,7 +858,7 @@ dynLoadObjs dflags objs = do
consIORef (filesToNotIntermediateClean dflags) soFile
m <- loadDLL soFile
case m of
- Nothing -> return ()
+ Nothing -> return pls { last_temp_so = Just soFile }
Just err -> panic ("Loading temp shared object failed: " ++ err)
rmDupLinkables :: [Linkable] -- Already loaded
Index: ghc-7.8.4/compiler/main/SysTools.lhs
===================================================================
--- ghc-7.8.4.orig/compiler/main/SysTools.lhs
+++ ghc-7.8.4/compiler/main/SysTools.lhs
@@ -1416,6 +1416,7 @@ linkDynLib dflags0 o_files dep_packages
in package_hs_libs ++ extra_libs ++ other_flags
-- probably _stub.o files
+ -- and last temporary shaerd object file
let extra_ld_inputs = ldInputs dflags
case os of
@@ -1533,8 +1534,8 @@ linkDynLib dflags0 o_files dep_packages
-- Set the library soname. We use -h rather than -soname as
-- Solaris 10 doesn't support the latter:
++ [ Option ("-Wl,-h," ++ takeFileName output_fn) ]
- ++ map Option lib_path_opts
++ extra_ld_inputs
+ ++ map Option lib_path_opts
++ map Option pkg_lib_path_opts
++ map Option pkg_link_opts
)
Index: ghc-7.8.4/rts/Linker.c
===================================================================
--- ghc-7.8.4.orig/rts/Linker.c
+++ ghc-7.8.4/rts/Linker.c
@@ -1777,7 +1777,7 @@ internal_dlopen(const char *dll_name)
// (see POSIX also)
ACQUIRE_LOCK(&dl_mutex);
- hdl = dlopen(dll_name, RTLD_LAZY | RTLD_GLOBAL);
+ hdl = dlopen(dll_name, RTLD_LAZY|RTLD_LOCAL); /* see Note [RTLD_LOCAL] */
errmsg = NULL;
if (hdl == NULL) {
@@ -1787,11 +1787,12 @@ internal_dlopen(const char *dll_name)
errmsg_copy = stgMallocBytes(strlen(errmsg)+1, "addDLL");
strcpy(errmsg_copy, errmsg);
errmsg = errmsg_copy;
+ } else {
+ o_so = stgMallocBytes(sizeof(OpenedSO), "addDLL");
+ o_so->handle = hdl;
+ o_so->next = openedSOs;
+ openedSOs = o_so;
}
- o_so = stgMallocBytes(sizeof(OpenedSO), "addDLL");
- o_so->handle = hdl;
- o_so->next = openedSOs;
- openedSOs = o_so;
RELEASE_LOCK(&dl_mutex);
//--------------- End critical section -------------------
@@ -1799,14 +1800,39 @@ internal_dlopen(const char *dll_name)
return errmsg;
}
+/*
+ Note [RTLD_LOCAL]
+
+ In GHCi we want to be able to override previous .so's with newly
+ loaded .so's when we recompile something. This further implies that
+ when we look up a symbol in internal_dlsym() we have to iterate
+ through the loaded libraries (in order from most recently loaded to
+ oldest) looking up the symbol in each one until we find it.
+
+ However, this can cause problems for some symbols that are copied
+ by the linker into the executable image at runtime - see #8935 for a
+ lengthy discussion. To solve that problem we need to look up
+ symbols in the main executable *first*, before attempting to look
+ them up in the loaded .so's. But in order to make that work, we
+ have to always call dlopen with RTLD_LOCAL, so that the loaded
+ libraries don't populate the global symbol table.
+*/
+
static void *
-internal_dlsym(void *hdl, const char *symbol) {
+internal_dlsym(const char *symbol) {
OpenedSO* o_so;
void *v;
// We acquire dl_mutex as concurrent dl* calls may alter dlerror
ACQUIRE_LOCK(&dl_mutex);
dlerror();
+ // look in program first
+ v = dlsym(dl_prog_handle, symbol);
+ if (dlerror() == NULL) {
+ RELEASE_LOCK(&dl_mutex);
+ return v;
+ }
+
for (o_so = openedSOs; o_so != NULL; o_so = o_so->next) {
v = dlsym(o_so->handle, symbol);
if (dlerror() == NULL) {
@@ -1814,7 +1840,6 @@ internal_dlsym(void *hdl, const char *sy
return v;
}
}
- v = dlsym(hdl, symbol);
RELEASE_LOCK(&dl_mutex);
return v;
}
@@ -1982,7 +2007,7 @@ lookupSymbol( char *lbl )
if (!ghciLookupSymbolTable(symhash, lbl, &val)) {
IF_DEBUG(linker, debugBelch("lookupSymbol: symbol not found\n"));
# if defined(OBJFORMAT_ELF)
- return internal_dlsym(dl_prog_handle, lbl);
+ return internal_dlsym(lbl);
# elif defined(OBJFORMAT_MACHO)
# if HAVE_DLFCN_H
/* On OS X 10.3 and later, we use dlsym instead of the old legacy
@@ -1996,7 +2021,7 @@ lookupSymbol( char *lbl )
*/
IF_DEBUG(linker, debugBelch("lookupSymbol: looking up %s with dlsym\n", lbl));
ASSERT(lbl[0] == '_');
- return internal_dlsym(dl_prog_handle, lbl + 1);
+ return internal_dlsym(lbl + 1);
# else
if (NSIsSymbolNameDefined(lbl)) {
NSSymbol symbol = NSLookupAndBindSymbol(lbl);

View File

@ -1,320 +0,0 @@
Index: ghc-7.8.3/compiler/cmm/CLabel.hs
===================================================================
--- ghc-7.8.3.orig/compiler/cmm/CLabel.hs
+++ ghc-7.8.3/compiler/cmm/CLabel.hs
@@ -1158,7 +1158,8 @@ pprDynamicLinkerAsmLabel platform dllInf
else if osElfTarget (platformOS platform)
then if platformArch platform == ArchPPC
then case dllInfo of
- CodeStub -> ppr lbl <> text "@plt"
+ CodeStub -> -- See Note [.LCTOC1 in PPC PIC code]
+ ppr lbl <> text "+32768@plt"
SymbolPtr -> text ".LC_" <> ppr lbl
_ -> panic "pprDynamicLinkerAsmLabel"
else if platformArch platform == ArchX86_64
Index: ghc-7.8.3/compiler/nativeGen/PIC.hs
===================================================================
--- ghc-7.8.3.orig/compiler/nativeGen/PIC.hs
+++ ghc-7.8.3/compiler/nativeGen/PIC.hs
@@ -54,7 +54,6 @@ import qualified X86.Instr as X86
import Platform
import Instruction
-import Size
import Reg
import NCGMonad
@@ -468,11 +467,8 @@ pprGotDeclaration dflags ArchX86 OSDarwi
pprGotDeclaration _ _ OSDarwin
= empty
--- pprGotDeclaration
+-- Emit GOT declaration
-- Output whatever needs to be output once per .s file.
--- The .LCTOC1 label is defined to point 32768 bytes into the table,
--- to make the most of the PPC's 16-bit displacements.
--- Only needed for PIC.
pprGotDeclaration dflags arch os
| osElfTarget os
, arch /= ArchPPC_64
@@ -482,6 +478,7 @@ pprGotDeclaration dflags arch os
| osElfTarget os
, arch /= ArchPPC_64
= vcat [
+ -- See Note [.LCTOC1 in PPC PIC code]
ptext (sLit ".section \".got2\",\"aw\""),
ptext (sLit ".LCTOC1 = .+32768") ]
@@ -688,12 +685,7 @@ pprImportedSymbol _ _ _
-- Get a pointer to our own fake GOT, which is defined on a per-module basis.
--- This is exactly how GCC does it, and it's quite horrible:
--- We first fetch the address of a local label (mkPicBaseLabel).
--- Then we add a 16-bit offset to that to get the address of a .long that we
--- define in .text space right next to the proc. This .long literal contains
--- the (32-bit) offset from our local label to our global offset table
--- (.LCTOC1 aka gotOffLabel).
+-- This is exactly how GCC does it in linux.
initializePicBase_ppc
:: Arch -> OS -> Reg
@@ -704,18 +696,9 @@ initializePicBase_ppc ArchPPC os picReg
(CmmProc info lab live (ListGraph blocks) : statics)
| osElfTarget os
= do
- dflags <- getDynFlags
- gotOffLabel <- getNewLabelNat
- tmp <- getNewRegNat $ intSize (wordWidth dflags)
let
- gotOffset = CmmData Text $ Statics gotOffLabel [
- CmmStaticLit (CmmLabelDiffOff gotLabel
- mkPicBaseLabel
- 0)
- ]
- offsetToOffset
- = PPC.ImmConstantDiff
- (PPC.ImmCLbl gotOffLabel)
+ gotOffset = PPC.ImmConstantDiff
+ (PPC.ImmCLbl gotLabel)
(PPC.ImmCLbl mkPicBaseLabel)
blocks' = case blocks of
@@ -726,15 +709,23 @@ initializePicBase_ppc ArchPPC os picReg
| bID `mapMember` info = fetchPC b
| otherwise = b
+ -- GCC does PIC prologs thusly:
+ -- bcl 20,31,.L1
+ -- .L1:
+ -- mflr 30
+ -- addis 30,30,.LCTOC1-.L1@ha
+ -- addi 30,30,.LCTOC1-.L1@l
+ -- TODO: below we use it over temporary register,
+ -- it can and should be optimised by picking
+ -- correct PIC reg.
fetchPC (BasicBlock bID insns) =
BasicBlock bID (PPC.FETCHPC picReg
- : PPC.ADDIS tmp picReg (PPC.HI offsetToOffset)
- : PPC.LD PPC.archWordSize tmp
- (PPC.AddrRegImm tmp (PPC.LO offsetToOffset))
- : PPC.ADD picReg picReg (PPC.RIReg picReg)
+ : PPC.ADDIS picReg picReg (PPC.HA gotOffset)
+ : PPC.ADDI picReg picReg (PPC.LO gotOffset)
+ : PPC.MR PPC.r30 picReg
: insns)
- return (CmmProc info lab live (ListGraph blocks') : gotOffset : statics)
+ return (CmmProc info lab live (ListGraph blocks') : statics)
initializePicBase_ppc ArchPPC OSDarwin picReg
Index: ghc-7.8.3/compiler/nativeGen/PPC/CodeGen.hs
===================================================================
--- ghc-7.8.3.orig/compiler/nativeGen/PPC/CodeGen.hs
+++ ghc-7.8.3/compiler/nativeGen/PPC/CodeGen.hs
@@ -54,7 +54,7 @@ import Outputable
import Unique
import DynFlags
-import Control.Monad ( mapAndUnzipM )
+import Control.Monad ( mapAndUnzipM, when )
import Data.Bits
import Data.Word
@@ -355,6 +355,19 @@ iselExpr64 (CmmMachOp (MO_Add _) [e1,e2]
ADDE rhi r1hi r2hi ]
return (ChildCode64 code rlo)
+iselExpr64 (CmmMachOp (MO_Sub _) [e1,e2]) = do
+ ChildCode64 code1 r1lo <- iselExpr64 e1
+ ChildCode64 code2 r2lo <- iselExpr64 e2
+ (rlo,rhi) <- getNewRegPairNat II32
+ let
+ r1hi = getHiVRegFromLo r1lo
+ r2hi = getHiVRegFromLo r2lo
+ code = code1 `appOL`
+ code2 `appOL`
+ toOL [ SUBFC rlo r2lo r1lo,
+ SUBFE rhi r2hi r1hi ]
+ return (ChildCode64 code rlo)
+
iselExpr64 (CmmMachOp (MO_UU_Conv W32 W64) [expr]) = do
(expr_reg,expr_code) <- getSomeReg expr
(rlo, rhi) <- getNewRegPairNat II32
@@ -927,8 +940,12 @@ genCCall' dflags gcp target dest_regs ar
(toOL []) []
(labelOrExpr, reduceToFF32) <- case target of
- ForeignTarget (CmmLit (CmmLabel lbl)) _ -> return (Left lbl, False)
- ForeignTarget expr _ -> return (Right expr, False)
+ ForeignTarget (CmmLit (CmmLabel lbl)) _ -> do
+ uses_pic_base_implicitly
+ return (Left lbl, False)
+ ForeignTarget expr _ -> do
+ uses_pic_base_implicitly
+ return (Right expr, False)
PrimTarget mop -> outOfLineMachOp mop
let codeBefore = move_sp_down finalStack `appOL` passArgumentsCode
@@ -949,6 +966,13 @@ genCCall' dflags gcp target dest_regs ar
where
platform = targetPlatform dflags
+ uses_pic_base_implicitly = do
+ -- See Note [implicit register in PPC PIC code]
+ -- on why we claim to use PIC register here
+ when (gopt Opt_PIC dflags) $ do
+ _ <- getPicBaseNat archWordSize
+ return ()
+
initialStackOffset = case gcp of
GCPDarwin -> 24
GCPLinux -> 8
@@ -1432,3 +1456,21 @@ coerceFP2Int _ toRep x = do
-- read low word of value (high word is undefined)
LD II32 dst (spRel dflags 3)]
return (Any (intSize toRep) code')
+
+-- Note [.LCTOC1 in PPC PIC code]
+-- The .LCTOC1 label is defined to point 32768 bytes into the GOT table
+-- to make the most of the PPC's 16-bit displacements.
+-- As 16-bit signed offset is used (usually via addi/lwz instructions)
+-- first element will have '-32768' offset against .LCTOC1.
+
+-- Note [implicit register in PPC PIC code]
+-- PPC generates calls by labels in assembly
+-- in form of:
+-- bl puts+32768@plt
+-- in this form it's not seen directly (by GHC NCG)
+-- that r30 (PicBaseReg) is used,
+-- but r30 is a required part of PLT code setup:
+-- puts+32768@plt:
+-- lwz r11,-30484(r30) ; offset in .LCTOC1
+-- mtctr r11
+-- bctr
Index: ghc-7.8.3/compiler/nativeGen/PPC/Instr.hs
===================================================================
--- ghc-7.8.3.orig/compiler/nativeGen/PPC/Instr.hs
+++ ghc-7.8.3/compiler/nativeGen/PPC/Instr.hs
@@ -203,8 +203,11 @@ data Instr
| ADD Reg Reg RI -- dst, src1, src2
| ADDC Reg Reg Reg -- (carrying) dst, src1, src2
| ADDE Reg Reg Reg -- (extend) dst, src1, src2
+ | ADDI Reg Reg Imm -- Add Immediate dst, src1, src2
| ADDIS Reg Reg Imm -- Add Immediate Shifted dst, src1, src2
| SUBF Reg Reg Reg -- dst, src1, src2 ; dst = src2 - src1
+ | SUBFC Reg Reg Reg -- (carrying) dst, src1, src2 ; dst = src2 - src1
+ | SUBFE Reg Reg Reg -- (extend) dst, src1, src2 ; dst = src2 - src1
| MULLW Reg Reg RI
| DIVW Reg Reg Reg
| DIVWU Reg Reg Reg
@@ -282,8 +285,11 @@ ppc_regUsageOfInstr platform instr
ADD reg1 reg2 ri -> usage (reg2 : regRI ri, [reg1])
ADDC reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
ADDE reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
+ ADDI reg1 reg2 _ -> usage ([reg2], [reg1])
ADDIS reg1 reg2 _ -> usage ([reg2], [reg1])
SUBF reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
+ SUBFC reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
+ SUBFE reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
MULLW reg1 reg2 ri -> usage (reg2 : regRI ri, [reg1])
DIVW reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
DIVWU reg1 reg2 reg3 -> usage ([reg2,reg3], [reg1])
@@ -356,8 +362,11 @@ ppc_patchRegsOfInstr instr env
ADD reg1 reg2 ri -> ADD (env reg1) (env reg2) (fixRI ri)
ADDC reg1 reg2 reg3 -> ADDC (env reg1) (env reg2) (env reg3)
ADDE reg1 reg2 reg3 -> ADDE (env reg1) (env reg2) (env reg3)
+ ADDI reg1 reg2 imm -> ADDI (env reg1) (env reg2) imm
ADDIS reg1 reg2 imm -> ADDIS (env reg1) (env reg2) imm
SUBF reg1 reg2 reg3 -> SUBF (env reg1) (env reg2) (env reg3)
+ SUBFC reg1 reg2 reg3 -> SUBFC (env reg1) (env reg2) (env reg3)
+ SUBFE reg1 reg2 reg3 -> SUBFE (env reg1) (env reg2) (env reg3)
MULLW reg1 reg2 ri -> MULLW (env reg1) (env reg2) (fixRI ri)
DIVW reg1 reg2 reg3 -> DIVW (env reg1) (env reg2) (env reg3)
DIVWU reg1 reg2 reg3 -> DIVWU (env reg1) (env reg2) (env reg3)
Index: ghc-7.8.3/compiler/nativeGen/PPC/Ppr.hs
===================================================================
--- ghc-7.8.3.orig/compiler/nativeGen/PPC/Ppr.hs
+++ ghc-7.8.3/compiler/nativeGen/PPC/Ppr.hs
@@ -530,6 +530,16 @@ pprInstr (BCTRL _) = hcat [
ptext (sLit "bctrl")
]
pprInstr (ADD reg1 reg2 ri) = pprLogic (sLit "add") reg1 reg2 ri
+pprInstr (ADDI reg1 reg2 imm) = hcat [
+ char '\t',
+ ptext (sLit "addi"),
+ char '\t',
+ pprReg reg1,
+ ptext (sLit ", "),
+ pprReg reg2,
+ ptext (sLit ", "),
+ pprImm imm
+ ]
pprInstr (ADDIS reg1 reg2 imm) = hcat [
char '\t',
ptext (sLit "addis"),
@@ -544,6 +554,8 @@ pprInstr (ADDIS reg1 reg2 imm) = hcat [
pprInstr (ADDC reg1 reg2 reg3) = pprLogic (sLit "addc") reg1 reg2 (RIReg reg3)
pprInstr (ADDE reg1 reg2 reg3) = pprLogic (sLit "adde") reg1 reg2 (RIReg reg3)
pprInstr (SUBF reg1 reg2 reg3) = pprLogic (sLit "subf") reg1 reg2 (RIReg reg3)
+pprInstr (SUBFC reg1 reg2 reg3) = pprLogic (sLit "subfc") reg1 reg2 (RIReg reg3)
+pprInstr (SUBFE reg1 reg2 reg3) = pprLogic (sLit "subfe") reg1 reg2 (RIReg reg3)
pprInstr (MULLW reg1 reg2 ri@(RIReg _)) = pprLogic (sLit "mullw") reg1 reg2 ri
pprInstr (MULLW reg1 reg2 ri@(RIImm _)) = pprLogic (sLit "mull") reg1 reg2 ri
pprInstr (DIVW reg1 reg2 reg3) = pprLogic (sLit "divw") reg1 reg2 (RIReg reg3)
Index: ghc-7.8.3/compiler/nativeGen/PPC/Regs.hs
===================================================================
--- ghc-7.8.3.orig/compiler/nativeGen/PPC/Regs.hs
+++ ghc-7.8.3/compiler/nativeGen/PPC/Regs.hs
@@ -35,7 +35,8 @@ module PPC.Regs (
fits16Bits,
makeImmediate,
fReg,
- sp, r3, r4, r27, r28, f1, f20, f21,
+ sp, r3, r4, r27, r28, r30,
+ f1, f20, f21,
allocatableRegs
@@ -293,12 +294,13 @@ point registers.
fReg :: Int -> RegNo
fReg x = (32 + x)
-sp, r3, r4, r27, r28, f1, f20, f21 :: Reg
+sp, r3, r4, r27, r28, r30, f1, f20, f21 :: Reg
sp = regSingle 1
r3 = regSingle 3
r4 = regSingle 4
r27 = regSingle 27
r28 = regSingle 28
+r30 = regSingle 30
f1 = regSingle $ fReg 1
f20 = regSingle $ fReg 20
f21 = regSingle $ fReg 21
Index: ghc-7.8.3/includes/CodeGen.Platform.hs
===================================================================
--- ghc-7.8.3.orig/includes/CodeGen.Platform.hs
+++ ghc-7.8.3/includes/CodeGen.Platform.hs
@@ -804,6 +804,8 @@ freeReg 1 = fastBool False -- The Stack
# if !MACHREGS_darwin
-- most non-darwin powerpc OSes use r2 as a TOC pointer or something like that
freeReg 2 = fastBool False
+-- at least linux in -fPIC relies on r30 in PLT stubs
+freeReg 30 = fastBool False
# endif
# ifdef REG_Base
freeReg REG_Base = fastBool False
Index: ghc-7.8.3/mk/config.mk.in
===================================================================
--- ghc-7.8.3.orig/mk/config.mk.in
+++ ghc-7.8.3/mk/config.mk.in
@@ -95,7 +95,7 @@ TargetElf = YES
endif
# Some platforms don't support shared libraries
-NoSharedLibsPlatformList = powerpc-unknown-linux \
+NoSharedLibsPlatformList = \
x86_64-unknown-mingw32 \
i386-unknown-mingw32 \
sparc-sun-solaris2 \

View File

@ -1,3 +0,0 @@
<services>
<service name="download_files" mode="localonly"/>
</services>

3
ghc-7.10.2-src.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:54cd73755b784d78e2f13d5eb161bfa38d3efee9e8a56f7eb6cd9f2d6e2615f5
size 11113204

View File

@ -1,34 +0,0 @@
commit b0cf3ab7a69b878a4335d21a347b56e4b0ca0b7b
Author: Sergei Trofimovich <slyfox@gentoo.org>
Date: Mon Apr 14 19:06:24 2014 +0300
compiler/cmm/PprC.hs: constify local string literals
Consider one-line module
module B (v) where v = "hello"
in -fvia-C mode it generates code like
static char gibberish_str[] = "hello";
It uselessly eats data section (precious resource on ia64!).
The patch switches genrator to emit:
static const char gibberish_str[] = "hello";
Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
diff --git a/compiler/cmm/PprC.hs b/compiler/cmm/PprC.hs
index 2398981..fdb578d 100644
--- a/compiler/cmm/PprC.hs
+++ b/compiler/cmm/PprC.hs
@@ -112,6 +112,12 @@ pprTop (CmmProc infos clbl _ graph) =
-- We only handle (a) arrays of word-sized things and (b) strings.
+pprTop (CmmData ReadOnlyData (Statics lbl [CmmString str])) =
+ hcat [
+ pprLocalness lbl, ptext (sLit "const char "), ppr lbl,
+ ptext (sLit "[] = "), pprStringInCStyle str, semi
+ ]
+
pprTop (CmmData _section (Statics lbl [CmmString str])) =
hcat [
pprLocalness lbl, ptext (sLit "char "), ppr lbl,

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c319cd94adb284177ed0e6d21546ed0b900ad84b86b87c06a99eac35152982c4
size 9128576

View File

@ -1,322 +0,0 @@
commit c29bf984dd20431cd4344e8a5c444d7a5be08389
Author: Colin Watson <cjwatson@debian.org>
Date: Mon Apr 21 22:26:56 2014 -0500
Bug: https://ghc.haskell.org/trac/ghc/ticket/7942
ghc: initial AArch64 patches
Signed-off-by: Austin Seipp <austin@well-typed.com>
Index: ghc-7.8.4/aclocal.m4
===================================================================
--- ghc-7.8.4.orig/aclocal.m4
+++ ghc-7.8.4/aclocal.m4
@@ -200,6 +200,9 @@ AC_DEFUN([FPTOOLS_SET_HASKELL_PLATFORM_V
GET_ARM_ISA()
test -z "[$]2" || eval "[$]2=\"ArchARM {armISA = \$ARM_ISA, armISAExt = \$ARM_ISA_EXT, armABI = \$ARM_ABI}\""
;;
+ aarch64)
+ test -z "[$]2" || eval "[$]2=ArchARM64"
+ ;;
alpha)
test -z "[$]2" || eval "[$]2=ArchAlpha"
;;
@@ -1865,6 +1868,9 @@ AC_MSG_CHECKING(for path to top of build
# converts cpu from gnu to ghc naming, and assigns the result to $target_var
AC_DEFUN([GHC_CONVERT_CPU],[
case "$1" in
+ aarch64*)
+ $2="aarch64"
+ ;;
alpha*)
$2="alpha"
;;
Index: ghc-7.8.4/compiler/nativeGen/AsmCodeGen.lhs
===================================================================
--- ghc-7.8.4.orig/compiler/nativeGen/AsmCodeGen.lhs
+++ ghc-7.8.4/compiler/nativeGen/AsmCodeGen.lhs
@@ -166,6 +166,7 @@ nativeCodeGen dflags this_mod h us cmms
ArchPPC -> nCG' (ppcNcgImpl dflags)
ArchSPARC -> nCG' (sparcNcgImpl dflags)
ArchARM {} -> panic "nativeCodeGen: No NCG for ARM"
+ ArchARM64 -> panic "nativeCodeGen: No NCG for ARM64"
ArchPPC_64 _ -> nCG' (ppcNcgImpl dflags)
ArchAlpha -> panic "nativeCodeGen: No NCG for Alpha"
ArchMipseb -> panic "nativeCodeGen: No NCG for mipseb"
Index: ghc-7.8.4/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
===================================================================
--- ghc-7.8.4.orig/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
+++ ghc-7.8.4/compiler/nativeGen/RegAlloc/Graph/TrivColorable.hs
@@ -113,6 +113,7 @@ trivColorable platform virtualRegSqueeze
ArchSPARC -> 14
ArchPPC_64 _ -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
+ ArchARM64 -> panic "trivColorable ArchARM64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
@@ -137,6 +138,7 @@ trivColorable platform virtualRegSqueeze
ArchSPARC -> 22
ArchPPC_64 _ -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
+ ArchARM64 -> panic "trivColorable ArchARM64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
@@ -161,6 +163,7 @@ trivColorable platform virtualRegSqueeze
ArchSPARC -> 11
ArchPPC_64 _ -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
+ ArchARM64 -> panic "trivColorable ArchARM64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
@@ -185,6 +188,7 @@ trivColorable platform virtualRegSqueeze
ArchSPARC -> 0
ArchPPC_64 _ -> panic "trivColorable ArchPPC_64"
ArchARM _ _ _ -> panic "trivColorable ArchARM"
+ ArchARM64 -> panic "trivColorable ArchARM64"
ArchAlpha -> panic "trivColorable ArchAlpha"
ArchMipseb -> panic "trivColorable ArchMipseb"
ArchMipsel -> panic "trivColorable ArchMipsel"
Index: ghc-7.8.4/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
===================================================================
--- ghc-7.8.4.orig/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
+++ ghc-7.8.4/compiler/nativeGen/RegAlloc/Linear/FreeRegs.hs
@@ -74,6 +74,7 @@ maxSpillSlots dflags
ArchPPC -> PPC.Instr.maxSpillSlots dflags
ArchSPARC -> SPARC.Instr.maxSpillSlots dflags
ArchARM _ _ _ -> panic "maxSpillSlots ArchARM"
+ ArchARM64 -> panic "maxSpillSlots ArchARM64"
ArchPPC_64 _ -> PPC.Instr.maxSpillSlots dflags
ArchAlpha -> panic "maxSpillSlots ArchAlpha"
ArchMipseb -> panic "maxSpillSlots ArchMipseb"
Index: ghc-7.8.4/compiler/nativeGen/RegAlloc/Linear/Main.hs
===================================================================
--- ghc-7.8.4.orig/compiler/nativeGen/RegAlloc/Linear/Main.hs
+++ ghc-7.8.4/compiler/nativeGen/RegAlloc/Linear/Main.hs
@@ -207,6 +207,7 @@ linearRegAlloc dflags entry_ids block_li
ArchSPARC -> linearRegAlloc' dflags (frInitFreeRegs platform :: SPARC.FreeRegs) entry_ids block_live sccs
ArchPPC -> linearRegAlloc' dflags (frInitFreeRegs platform :: PPC.FreeRegs) entry_ids block_live sccs
ArchARM _ _ _ -> panic "linearRegAlloc ArchARM"
+ ArchARM64 -> panic "linearRegAlloc ArchARM64"
ArchPPC_64 _ -> linearRegAlloc' dflags (frInitFreeRegs platform :: PPC.FreeRegs) entry_ids block_live sccs
ArchAlpha -> panic "linearRegAlloc ArchAlpha"
ArchMipseb -> panic "linearRegAlloc ArchMipseb"
Index: ghc-7.8.4/compiler/nativeGen/TargetReg.hs
===================================================================
--- ghc-7.8.4.orig/compiler/nativeGen/TargetReg.hs
+++ ghc-7.8.4/compiler/nativeGen/TargetReg.hs
@@ -54,6 +54,7 @@ targetVirtualRegSqueeze platform
ArchSPARC -> SPARC.virtualRegSqueeze
ArchPPC_64 _ -> PPC.virtualRegSqueeze
ArchARM _ _ _ -> panic "targetVirtualRegSqueeze ArchARM"
+ ArchARM64 -> panic "targetVirtualRegSqueeze ArchARM64"
ArchAlpha -> panic "targetVirtualRegSqueeze ArchAlpha"
ArchMipseb -> panic "targetVirtualRegSqueeze ArchMipseb"
ArchMipsel -> panic "targetVirtualRegSqueeze ArchMipsel"
@@ -70,6 +71,7 @@ targetRealRegSqueeze platform
ArchSPARC -> SPARC.realRegSqueeze
ArchPPC_64 _ -> PPC.realRegSqueeze
ArchARM _ _ _ -> panic "targetRealRegSqueeze ArchARM"
+ ArchARM64 -> panic "targetRealRegSqueeze ArchARM64"
ArchAlpha -> panic "targetRealRegSqueeze ArchAlpha"
ArchMipseb -> panic "targetRealRegSqueeze ArchMipseb"
ArchMipsel -> panic "targetRealRegSqueeze ArchMipsel"
@@ -85,6 +87,7 @@ targetClassOfRealReg platform
ArchSPARC -> SPARC.classOfRealReg
ArchPPC_64 _ -> PPC.classOfRealReg
ArchARM _ _ _ -> panic "targetClassOfRealReg ArchARM"
+ ArchARM64 -> panic "targetClassOfRealReg ArchARM64"
ArchAlpha -> panic "targetClassOfRealReg ArchAlpha"
ArchMipseb -> panic "targetClassOfRealReg ArchMipseb"
ArchMipsel -> panic "targetClassOfRealReg ArchMipsel"
@@ -100,6 +103,7 @@ targetMkVirtualReg platform
ArchSPARC -> SPARC.mkVirtualReg
ArchPPC_64 _ -> PPC.mkVirtualReg
ArchARM _ _ _ -> panic "targetMkVirtualReg ArchARM"
+ ArchARM64 -> panic "targetMkVirtualReg ArchARM64"
ArchAlpha -> panic "targetMkVirtualReg ArchAlpha"
ArchMipseb -> panic "targetMkVirtualReg ArchMipseb"
ArchMipsel -> panic "targetMkVirtualReg ArchMipsel"
@@ -115,6 +119,7 @@ targetRegDotColor platform
ArchSPARC -> SPARC.regDotColor
ArchPPC_64 _ -> PPC.regDotColor
ArchARM _ _ _ -> panic "targetRegDotColor ArchARM"
+ ArchARM64 -> panic "targetRegDotColor ArchARM64"
ArchAlpha -> panic "targetRegDotColor ArchAlpha"
ArchMipseb -> panic "targetRegDotColor ArchMipseb"
ArchMipsel -> panic "targetRegDotColor ArchMipsel"
Index: ghc-7.8.4/compiler/utils/Platform.hs
===================================================================
--- ghc-7.8.4.orig/compiler/utils/Platform.hs
+++ ghc-7.8.4/compiler/utils/Platform.hs
@@ -55,6 +55,7 @@ data Arch
, armISAExt :: [ArmISAExt]
, armABI :: ArmABI
}
+ | ArchARM64
| ArchAlpha
| ArchMipseb
| ArchMipsel
Index: ghc-7.8.4/includes/stg/HaskellMachRegs.h
===================================================================
--- ghc-7.8.4.orig/includes/stg/HaskellMachRegs.h
+++ ghc-7.8.4/includes/stg/HaskellMachRegs.h
@@ -39,6 +39,7 @@
|| powerpc64le_TARGET_ARCH || rs6000_TARGET_ARCH)
#define MACHREGS_sparc sparc_TARGET_ARCH
#define MACHREGS_arm arm_TARGET_ARCH
+#define MACHREGS_aarch64 aarch64_TARGET_ARCH
#define MACHREGS_darwin darwin_TARGET_OS
#endif
Index: ghc-7.8.4/includes/stg/MachRegs.h
===================================================================
--- ghc-7.8.4.orig/includes/stg/MachRegs.h
+++ ghc-7.8.4/includes/stg/MachRegs.h
@@ -1,6 +1,6 @@
/* -----------------------------------------------------------------------------
*
- * (c) The GHC Team, 1998-2011
+ * (c) The GHC Team, 1998-2014
*
* Registers used in STG code. Might or might not correspond to
* actual machine registers.
@@ -531,6 +531,61 @@
#define REG_D2 d11
#endif
+/* -----------------------------------------------------------------------------
+ The ARMv8/AArch64 ABI register mapping
+
+ The AArch64 provides 31 64-bit general purpose registers
+ and 32 128-bit SIMD/floating point registers.
+
+ General purpose registers (see Chapter 5.1.1 in ARM IHI 0055B)
+
+ Register | Special | Role in the procedure call standard
+ ---------+---------+------------------------------------
+ SP | | The Stack Pointer
+ r30 | LR | The Link Register
+ r29 | FP | The Frame Pointer
+ r19-r28 | | Callee-saved registers
+ r18 | | The Platform Register, if needed;
+ | | or temporary register
+ r17 | IP1 | The second intra-procedure-call temporary register
+ r16 | IP0 | The first intra-procedure-call scratch register
+ r9-r15 | | Temporary registers
+ r8 | | Indirect result location register
+ r0-r7 | | Parameter/result registers
+
+
+ FPU/SIMD registers
+
+ s/d/q/v0-v7 Argument / result/ scratch registers
+ s/d/q/v8-v15 callee-saved registers (must be preserved across subrutine calls,
+ but only bottom 64-bit value needs to be preserved)
+ s/d/q/v16-v31 temporary registers
+
+ ----------------------------------------------------------------------------- */
+
+#elif MACHREGS_aarch64
+
+#define REG(x) __asm__(#x)
+
+#define REG_Base r19
+#define REG_Sp r20
+#define REG_Hp r21
+#define REG_R1 r22
+#define REG_R2 r23
+#define REG_R3 r24
+#define REG_R4 r25
+#define REG_R5 r26
+#define REG_R6 r27
+#define REG_SpLim r28
+
+#define REG_F1 s8
+#define REG_F2 s9
+#define REG_F3 s10
+#define REG_F4 s11
+
+#define REG_D1 d12
+#define REG_D2 d13
+
#else
#error Cannot find platform to give register info for
Index: ghc-7.8.4/rts/StgCRun.c
===================================================================
--- ghc-7.8.4.orig/rts/StgCRun.c
+++ ghc-7.8.4/rts/StgCRun.c
@@ -756,4 +756,70 @@ StgRun(StgFunPtr f, StgRegTable *basereg
}
#endif
+#ifdef aarch64_HOST_ARCH
+
+StgRegTable *
+StgRun(StgFunPtr f, StgRegTable *basereg) {
+ StgRegTable * r;
+ __asm__ volatile (
+ /*
+ * save callee-saves registers on behalf of the STG code.
+ */
+ "stp x19, x20, [sp, #-16]!\n\t"
+ "stp x21, x22, [sp, #-16]!\n\t"
+ "stp x23, x24, [sp, #-16]!\n\t"
+ "stp x25, x26, [sp, #-16]!\n\t"
+ "stp x27, x28, [sp, #-16]!\n\t"
+ "stp ip0, ip1, [sp, #-16]!\n\t"
+ "str lr, [sp, #-8]!\n\t"
+
+ /*
+ * allocate some space for Stg machine's temporary storage.
+ * Note: RESERVER_C_STACK_BYTES has to be a round number here or
+ * the assembler can't assemble it.
+ */
+ "str lr, [sp, %3]"
+ /* "sub sp, sp, %3\n\t" */
+ /*
+ * Set BaseReg
+ */
+ "mov x19, %2\n\t"
+ /*
+ * Jump to function argument.
+ */
+ "bx %1\n\t"
+
+ ".globl " STG_RETURN "\n\t"
+ ".type " STG_RETURN ", %%function\n"
+ STG_RETURN ":\n\t"
+ /*
+ * Free the space we allocated
+ */
+ "ldr lr, [sp], %3\n\t"
+ /* "add sp, sp, %3\n\t" */
+ /*
+ * Return the new register table, taking it from Stg's R1 (ARM64's R22).
+ */
+ "mov %0, x22\n\t"
+ /*
+ * restore callee-saves registers.
+ */
+ "ldr lr, [sp], #8\n\t"
+ "ldp ip0, ip1, [sp], #16\n\t"
+ "ldp x27, x28, [sp], #16\n\t"
+ "ldp x25, x26, [sp], #16\n\t"
+ "ldp x23, x24, [sp], #16\n\t"
+ "ldp x21, x22, [sp], #16\n\t"
+ "ldp x19, x20, [sp], #16\n\t"
+
+ : "=r" (r)
+ : "r" (f), "r" (basereg), "i" (RESERVED_C_STACK_BYTES)
+ : "%x19", "%x20", "%x21", "%x22", "%x23", "%x24", "%x25", "%x26", "%x27", "%x28",
+ "%ip0", "%ip1", "%lr"
+ );
+ return r;
+}
+
+#endif
+
#endif /* !USE_MINIINTERPRETER */

View File

@ -1,31 +0,0 @@
From 44cee4852282f63393d532aad59c5cd865ff3ed6 Mon Sep 17 00:00:00 2001
From: Erik de Castro Lopo <erikd@mega-nerd.com>
Date: Wed, 1 Apr 2015 04:46:01 +0000
Subject: [PATCH] mk/config.mk.in : Enable SMP and GHCi support for Aarch64.
---
mk/config.mk.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
Index: ghc-7.8.4/mk/config.mk.in
===================================================================
--- ghc-7.8.4.orig/mk/config.mk.in
+++ ghc-7.8.4/mk/config.mk.in
@@ -174,7 +174,7 @@ HaveLibDL = @HaveLibDL@
# ArchSupportsSMP should be set iff there is support for that arch in
# includes/stg/SMP.h
-ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le arm)))
+ArchSupportsSMP=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 sparc powerpc powerpc64 powerpc64le arm aarch64)))
GhcWithSMP := $(strip $(if $(filter YESNO, $(ArchSupportsSMP)$(GhcUnregisterised)),YES,NO))
@@ -182,7 +182,7 @@ GhcWithSMP := $(strip $(if $(filter YESN
# has support for this OS/ARCH combination.
OsSupportsGHCi=$(strip $(patsubst $(TargetOS_CPP), YES, $(findstring $(TargetOS_CPP), mingw32 cygwin32 linux solaris2 freebsd dragonfly netbsd openbsd darwin kfreebsdgnu)))
-ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc powerpc64 powerpc64le sparc sparc64 arm)))
+ArchSupportsGHCi=$(strip $(patsubst $(TargetArch_CPP), YES, $(findstring $(TargetArch_CPP), i386 x86_64 powerpc powerpc64 powerpc64le sparc sparc64 arm aarch64)))
ifeq "$(OsSupportsGHCi)$(ArchSupportsGHCi)" "YESYES"
GhcWithInterpreter=YES

View File

@ -1,26 +0,0 @@
From 7d738547049e686be4d90a19dcb9520418d5f72d Mon Sep 17 00:00:00 2001
From: Jens Petersen <petersen@redhat.com>
Date: Mon, 9 Jun 2014 15:48:41 +0900
Subject: [PATCH] define _DEFAULT_SOURCE in Stg.h to avoid warnings from glibc
2.20 (#9185)
---
includes/Stg.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/includes/Stg.h b/includes/Stg.h
index 1707c9b..fbcf643 100644
--- a/includes/Stg.h
+++ b/includes/Stg.h
@@ -47,6 +47,8 @@
// We need _BSD_SOURCE so that math.h defines things like gamma
// on Linux
# define _BSD_SOURCE
+// glibc 2.20 deprecates _BSD_SOURCE in favour of _DEFAULT_SOURCE
+# define _DEFAULT_SOURCE
#endif
#if IN_STG_CODE == 0 || defined(llvm_CC_FLAVOR)
--
1.9.3

View File

@ -1,3 +1,39 @@
-------------------------------------------------------------------
Mon Aug 10 17:38:34 UTC 2015 - peter.trommler@ohm-hochschule.de
- update to 7.10.2
* type checker fixes
* fixes for Aarch64 support
* fix deadlock in runtime system when scheduling garbage collection
- 7.10.1 highlights
* implement Applicative Monad Proposal
* implement Burning Bridges Proposal
* support for partial type signatures
* reimplement integer-gmp
* support plugins in type checker (experimental!)
- drop llvm-powerpc64-datalayout.patch
* this patch was incomplete all along and now we have our native
code generator
- drop ghc-cabal-unversion-docdir.patch
* ghc-rpm-macros is following ghc's doc layout so no need to patch
- drop D349.patch
* fixed upstream
- drop integer-gmp.patch
* we do not support SLE11 anymore
- drop ghc-7.8.2-cgen-constify.patch
* fixed upstream
- drop D560.patch
* fixed upstream
- drop ghc-glibc-2.20_BSD_SOURCE.patch
* fixed upstream
- drop ghc-arm64.patch
* fixed upstream
- drop ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch
* fixed upstream
- refresh 0001-implement-native-code-generator-for-ppc64.patch
- disable ghc-7.8-arm-use-ld-gold.patch
* not sure we need this, must be rebased if we do
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jul 17 14:58:44 UTC 2015 - peter.trommler@ohm-hochschule.de Fri Jul 17 14:58:44 UTC 2015 - peter.trommler@ohm-hochschule.de

View File

@ -19,7 +19,7 @@
%global unregisterised_archs aarch64 s390 s390x %global unregisterised_archs aarch64 s390 s390x
Name: ghc Name: ghc
Version: 7.8.4 Version: 7.10.2
Release: 0 Release: 0
Url: http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2 Url: http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2
Summary: The Glorious Glasgow Haskell Compiler Summary: The Glorious Glasgow Haskell Compiler
@ -28,7 +28,7 @@ Group: Development/Languages/Other
ExclusiveArch: aarch64 %{ix86} x86_64 ppc ppc64 ppc64le s390 s390x ExclusiveArch: aarch64 %{ix86} x86_64 ppc ppc64 ppc64le s390 s390x
BuildRequires: binutils-devel BuildRequires: binutils-devel
BuildRequires: gcc BuildRequires: gcc
BuildRequires: ghc-bootstrap >= 7.4 BuildRequires: ghc-bootstrap >= 7.6
BuildRequires: ghc-rpm-macros-extra BuildRequires: ghc-rpm-macros-extra
BuildRequires: glibc-devel BuildRequires: glibc-devel
BuildRequires: gmp-devel BuildRequires: gmp-devel
@ -59,24 +59,8 @@ Requires: ghc-ghc-devel = %{version}-%{release}
Requires: ghc-libraries = %{version}-%{release} Requires: ghc-libraries = %{version}-%{release}
Source: http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.xz Source: http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.xz
Source1: ghc-rpmlintrc Source1: ghc-rpmlintrc
# PATCH-FIX-UPSTREAM llvm-powerpc64-datalayout.patch peter.trommler@ohm-hochschule.de - Add target datalayout for llvm on powerpc 64.
Patch8: llvm-powerpc64-datalayout.patch
# PATCH-FIX-UPSTREAM D349.patch peter.trommler@ohm-hochschule.de - Fix dynamic linker, see Haskell trac #8935.
Patch12: D349.patch
# PATCH-FIX-UPSTREAM integer-gmp.patch peter.trommler@ohm-hochschule.de -- Fix upstream ticket #8156 see https://ghc.haskell.org/trac/ghc/ticket/8156. We need this for SLE 11 where libgmp is too old and so we have to use the bundled libgmp. This patch fixes the build.
Patch13: integer-gmp.patch
# PATCH-FIX-UPSTREAM ghc-7.8.2-cgen-constify.patch peter.trommler@ohm-hochschule.de - Make constant strings constant in C backend to save data segment space. This is a gentoo patch.
Patch14: ghc-7.8.2-cgen-constify.patch
# PATCH-FIX-UPSTREAM D560.patch peter.trommler@ohm-hochschule.de -- Fix loading of PIC register. See https://phabricator.haskell.org/D560.
Patch18: D560.patch
# PATCH-FEATURE-UPSTREAM 0001-implement-native-code-generator-for-ppc64.patch peter.trommler@ohm-hochschule.de -- Implement native code generator for ppc64. Haskell Trac #9863. # PATCH-FEATURE-UPSTREAM 0001-implement-native-code-generator-for-ppc64.patch peter.trommler@ohm-hochschule.de -- Implement native code generator for ppc64. Haskell Trac #9863.
Patch19: 0001-implement-native-code-generator-for-ppc64.patch Patch19: 0001-implement-native-code-generator-for-ppc64.patch
# PATCH-FIX-UPSTREAM ghc-glibc-2.20_BSD_SOURCE.patch peter.trommler@ohm-hochschule.de -- Define _DEFAULT_SOURCE in Stg.h to avoid warnings from glibc. Fedora patch
Patch20: ghc-glibc-2.20_BSD_SOURCE.patch
# PATCH-FIX-OPENSUSE add aarch64 support
Patch21: ghc-arm64.patch
# PATCH-FIX-UPSTREAM ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch peter.trommler@ohm-hochschule.de -- Provide SMP implementation and enable GHCi on aarch64. Adapted from Fedora patch 26.
Patch22: ghc-config.mk.in-Enable-SMP-and-GHCi-support-for-Aarch64.patch
# PATCH-FIX-UPSTREAM peter.trommler@ohm-hochschule.de -- GNU ld does not work with ghc on aarch64 so use Gold. Adapted from Fedora patch 24. # PATCH-FIX-UPSTREAM peter.trommler@ohm-hochschule.de -- GNU ld does not work with ghc on aarch64 so use Gold. Adapted from Fedora patch 24.
Patch23: ghc-7.8-arm-use-ld-gold.patch Patch23: ghc-7.8-arm-use-ld-gold.patch
@ -125,32 +109,28 @@ To install all of GHC install package ghc.
%global ghc_pkg_c_deps ghc-compiler = %{ghc_version_override}-%{release} %global ghc_pkg_c_deps ghc-compiler = %{ghc_version_override}-%{release}
%if %{defined ghclibdir} %if %{defined ghclibdir}
%ghc_lib_subpackage Cabal 1.18.1.5 %ghc_lib_subpackage Cabal 1.22.4.0
%ghc_lib_subpackage array 0.5.0.0 %ghc_lib_subpackage array 0.5.1.0
%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.7.0.2 %ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.8.1.0
%ghc_lib_subpackage binary 0.7.1.0 %ghc_lib_subpackage binary 0.7.5.0
%ghc_lib_subpackage bytestring 0.10.4.0 %ghc_lib_subpackage bytestring 0.10.6.0
%ghc_lib_subpackage containers 0.5.5.1 %ghc_lib_subpackage containers 0.5.6.2
%ghc_lib_subpackage deepseq 1.3.0.2 %ghc_lib_subpackage deepseq 1.4.1.1
%ghc_lib_subpackage directory 1.2.1.0 %ghc_lib_subpackage directory 1.2.2.0
%ghc_lib_subpackage filepath 1.3.0.2 %ghc_lib_subpackage filepath 1.4.0.0
%define ghc_pkg_obsoletes ghc-bin-package-db-devel < 0.0.0.0-%{release} %define ghc_pkg_obsoletes ghc-bin-package-db-devel < 0.0.0.0-%{release}
%ghc_lib_subpackage -x ghc %{ghc_version_override} %ghc_lib_subpackage -x ghc %{ghc_version_override}
%undefine ghc_pkg_obsoletes %undefine ghc_pkg_obsoletes
%ghc_lib_subpackage haskeline 0.7.1.2 %ghc_lib_subpackage haskeline 0.7.2.1
%ghc_lib_subpackage haskell2010 1.1.2.0 %ghc_lib_subpackage hoopl 3.10.0.2
%ghc_lib_subpackage haskell98 2.0.0.3 %ghc_lib_subpackage hpc 0.6.0.2
%ghc_lib_subpackage hoopl 3.10.0.1 %ghc_lib_subpackage pretty 1.1.2.0
%ghc_lib_subpackage hpc 0.6.0.1 %ghc_lib_subpackage process 1.2.3.0
%ghc_lib_subpackage old-locale 1.0.0.6 %ghc_lib_subpackage template-haskell 2.10.0.0
%ghc_lib_subpackage old-time 1.1.0.2 %ghc_lib_subpackage terminfo 0.4.0.1
%ghc_lib_subpackage pretty 1.1.1.1 %ghc_lib_subpackage time 1.5.0.1
%ghc_lib_subpackage process 1.2.0.0 %ghc_lib_subpackage transformers 0.4.2.0
%ghc_lib_subpackage template-haskell 2.9.0.0 %ghc_lib_subpackage unix 2.7.1.0
%ghc_lib_subpackage terminfo 0.4.0.0
%ghc_lib_subpackage time 1.4.2
%ghc_lib_subpackage transformers 0.3.0.0
%ghc_lib_subpackage unix 2.7.0.1
%ghc_lib_subpackage xhtml 3000.2.1 %ghc_lib_subpackage xhtml 3000.2.1
%endif %endif
@ -172,21 +152,11 @@ except the ghc library, which is installed by the toplevel ghc metapackage.
%prep %prep
%setup -q %setup -q
%patch8 -p1
%patch12 -p1
%patch13 -p1
%patch14 -p1
%patch18 -p1
%patch19 -p1 %patch19 -p1
%patch20 -p1
%patch21 -p1
%ifarch aarch64
%patch22 -p1 -b .orig
%endif
%ifarch armv7hl aarch64 #%%ifarch armv7hl aarch64
%patch23 -p1 -b .24~ #%%patch23 -p1 -b .24~
%endif #%%endif
%build %build
# Patch 19 and 22 modify build system # Patch 19 and 22 modify build system
@ -296,8 +266,8 @@ echo "%dir %{ghclibdir}" >> ghc-base.files
%ghc_gen_filelists bin-package-db 0.0.0.0 %ghc_gen_filelists bin-package-db 0.0.0.0
%ghc_gen_filelists ghc %{ghc_version_override} %ghc_gen_filelists ghc %{ghc_version_override}
%ghc_gen_filelists ghc-prim 0.3.1.0 %ghc_gen_filelists ghc-prim 0.4.0.0
%ghc_gen_filelists integer-gmp 0.5.1.0 %ghc_gen_filelists integer-gmp 1.0.0.0
%define merge_filelist()\ %define merge_filelist()\
cat ghc-%1.files >> ghc-%2.files\ cat ghc-%1.files >> ghc-%2.files\
@ -310,12 +280,12 @@ echo "%doc libraries/LICENSE.%1" >> ghc-%2.files
%merge_filelist bin-package-db ghc %merge_filelist bin-package-db ghc
%if %{undefined ghc_without_shared} %if %{undefined ghc_without_shared}
echo %%dir %{ghclibdir}/rts-1.0 >> ghc-base.files echo %%dir %{ghclibdir}/rts >> ghc-base.files
ls %{buildroot}%{ghclibdir}/rts-1.0/libHS*.so >> ghc-base.files ls %{buildroot}%{ghclibdir}/rts/libHS*.so >> ghc-base.files
sed -i -e "s|^%{buildroot}||g" ghc-base.files sed -i -e "s|^%{buildroot}||g" ghc-base.files
%endif %endif
echo %%dir %{ghclibdir}/rts-1.0 >> ghc-base-devel.files echo %%dir %{ghclibdir}/rts >> ghc-base-devel.files
ls -d %{buildroot}%{ghclibdir}/rts-1.0/libHS*.a %{buildroot}%{ghclibdir}/package.conf.d/builtin_*.conf %{buildroot}%{ghclibdir}/include >> ghc-base-devel.files ls -d %{buildroot}%{ghclibdir}/rts/libHS*.a %{buildroot}%{ghclibdir}/package.conf.d/builtin_*.conf %{buildroot}%{ghclibdir}/include >> ghc-base-devel.files
sed -i -e "s|^%{buildroot}||g" ghc-base-devel.files sed -i -e "s|^%{buildroot}||g" ghc-base-devel.files
# these are handled as alternatives # these are handled as alternatives
@ -411,7 +381,6 @@ fi
%endif %endif
%{ghclibdir}/ghc-usage.txt %{ghclibdir}/ghc-usage.txt
%{ghclibdir}/ghci-usage.txt %{ghclibdir}/ghci-usage.txt
%{ghclibdir}/mkGmpDerivedConstants
%dir %{ghclibdir}/package.conf.d %dir %{ghclibdir}/package.conf.d
%ghost %{ghclibdir}/package.conf.d/package.cache %ghost %{ghclibdir}/package.conf.d/package.cache
%{ghclibdir}/platformConstants %{ghclibdir}/platformConstants

View File

@ -1,26 +0,0 @@
Index: ghc-7.8.3/libraries/integer-gmp/gmp/ghc.mk
===================================================================
--- ghc-7.8.3.orig/libraries/integer-gmp/gmp/ghc.mk
+++ ghc-7.8.3/libraries/integer-gmp/gmp/ghc.mk
@@ -66,6 +66,12 @@ else
BUILD_SHARED=no
endif
+ifeq "$(firstword $(subst -, ,$(HOSTPLATFORM)))" "x86_64"
+ FORCE_PIC=--with-pic=yes
+else
+ FORCE_PIC=
+endif
+
# In a bindist, we don't want to know whether /this/ machine has gmp,
# but whether the machine the bindist was built on had gmp.
ifeq "$(BINDIST)" "YES"
@@ -147,7 +153,7 @@ libraries/integer-gmp/gmp/libgmp.a libra
export PATH; \
cd gmpbuild && \
CC=$(CCX) NM=$(NM) AR=$(AR_STAGE1) ./configure \
- --enable-shared=no \
+ --enable-shared=no $(FORCE_PIC) \
--host=$(HOSTPLATFORM) --build=$(BUILDPLATFORM)
$(MAKE) -C libraries/integer-gmp/gmp/gmpbuild MAKEFLAGS=
$(CP) libraries/integer-gmp/gmp/gmpbuild/gmp.h libraries/integer-gmp/gmp/

View File

@ -1,14 +0,0 @@
Index: ghc-7.8.2/compiler/llvmGen/LlvmCodeGen/Ppr.hs
===================================================================
--- ghc-7.8.2.orig/compiler/llvmGen/LlvmCodeGen/Ppr.hs
+++ ghc-7.8.2/compiler/llvmGen/LlvmCodeGen/Ppr.hs
@@ -64,6 +64,9 @@ moduleLayout = sdocWithPlatform $ \platf
Platform { platformArch = ArchX86, platformOS = OSiOS } ->
text "target datalayout = \"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128-n8:16:32\""
$+$ text "target triple = \"i386-apple-darwin11\""
+ Platform { platformArch = ArchPPC_64 , platformOS = OSLinux } ->
+ text "target datalayout = \"E-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v128:128:128-n32:64\""
+ $+$ text "target triple = \"powerpc64-unknown-linux-gnu\""
_ ->
-- FIX: Other targets
empty