[Pkg-haskell-commits] darcs: ghc: * Apply patches taken from GHC HEAD that help building on ARM

Joachim Breitner mail at joachim-breitner.de
Mon Dec 8 19:05:50 UTC 2014


Mon Dec  8 17:47:07 UTC 2014  Joachim Breitner <mail at joachim-breitner.de>
  * * Apply patches taken from GHC HEAD that help building on ARM  
    - always_build_arm_spinlocks.patch
    - dll-split-fix.patch
    - linker-detection-fix

    M ./changelog +9
    A ./patches/always_build_arm_spinlocks.patch
    A ./patches/dll-split-fix.patch
    A ./patches/linker-detection-fix
    M ./patches/series +3

Mon Dec  8 17:47:07 UTC 2014  Joachim Breitner <mail at joachim-breitner.de>
  * * Apply patches taken from GHC HEAD that help building on ARM  
    - always_build_arm_spinlocks.patch
    - dll-split-fix.patch
    - linker-detection-fix
diff -rN -u old-ghc/changelog new-ghc/changelog
--- old-ghc/changelog	2014-12-08 19:05:50.231627511 +0000
+++ new-ghc/changelog	2014-12-08 19:05:50.271627506 +0000
@@ -1,3 +1,12 @@
+ghc (7.8.20141119-7) UNRELEASED; urgency=medium
+
+  * Apply patches taken from GHC HEAD that help building on ARM  
+    - always_build_arm_spinlocks.patch
+    - dll-split-fix.patch
+    - linker-detection-fix
+
+ -- Joachim Breitner <nomeata at debian.org>  Mon, 08 Dec 2014 18:46:19 +0100
+
 ghc (7.8.20141119-6) experimental; urgency=medium
 
   * According to Ben Gamari, the flag is -optl-B..., not -optc-B... 
diff -rN -u old-ghc/patches/always_build_arm_spinlocks.patch new-ghc/patches/always_build_arm_spinlocks.patch
--- old-ghc/patches/always_build_arm_spinlocks.patch	1970-01-01 00:00:00.000000000 +0000
+++ new-ghc/patches/always_build_arm_spinlocks.patch	2014-12-08 19:05:50.247627510 +0000
@@ -0,0 +1,69 @@
+commit e42f158ddc7b4d1d2ca41bd62fc9432030889ac7
+Author: Joachim Breitner <mail at joachim-breitner.de>
+Date:   Mon Dec 8 18:37:52 2014 +0100
+
+    Link pre-ARMv6 spinlocks into all RTS variants
+    
+    Summary:
+    For compatibility with ARM machines from pre v6, the RTS provides
+    implementations of certain atomic operations. Previously, these
+    were only included in the threaded RTS.
+    
+    But ghc (the library) contains the code in compiler/cbits/genSym.c, which
+    uses these operations if there is more than one capability. But there is only
+    one libHSghc, so the linker wants to resolve these symbols in every case.
+    
+    By providing these operations in all RTSs, the linker is happy. The only
+    downside is a small amount of dead code in the non-threaded RTS on old ARM
+    machines.
+    
+    Test Plan: It helped here.
+    
+    Reviewers: bgamari, austin
+    
+    Subscribers: carter, thomie
+    
+    Differential Revision: https://phabricator.haskell.org/D564
+    
+    GHC Trac Issues: #8951
+
+Index: ghc-7.8.3.20141119/includes/stg/SMP.h
+===================================================================
+--- ghc-7.8.3.20141119.orig/includes/stg/SMP.h	2014-12-08 18:44:25.438412602 +0100
++++ ghc-7.8.3.20141119/includes/stg/SMP.h	2014-12-08 18:44:25.434412386 +0100
+@@ -14,13 +14,13 @@
+ #ifndef SMP_H
+ #define SMP_H
+ 
+-#if defined(THREADED_RTS)
+-
+ #if arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6)
+ void arm_atomic_spin_lock(void);
+ void arm_atomic_spin_unlock(void);
+ #endif
+ 
++#if defined(THREADED_RTS)
++
+ /* ----------------------------------------------------------------------------
+    Atomic operations
+    ------------------------------------------------------------------------- */
+Index: ghc-7.8.3.20141119/rts/OldARMAtomic.c
+===================================================================
+--- ghc-7.8.3.20141119.orig/rts/OldARMAtomic.c	2014-12-08 18:44:25.438412602 +0100
++++ ghc-7.8.3.20141119/rts/OldARMAtomic.c	2014-12-08 18:44:32.678806807 +0100
+@@ -14,8 +14,6 @@
+ #include <sched.h>
+ #endif
+ 
+-#if defined(THREADED_RTS)
+-
+ #if arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6)
+ 
+ static volatile int atomic_spin = 0;
+@@ -51,6 +49,3 @@
+ } 
+ 
+ #endif  /* arm_HOST_ARCH && defined(arm_HOST_ARCH_PRE_ARMv6) */
+-
+-#endif  /* defined(THREADED_RTS) */
+-
diff -rN -u old-ghc/patches/dll-split-fix.patch new-ghc/patches/dll-split-fix.patch
--- old-ghc/patches/dll-split-fix.patch	1970-01-01 00:00:00.000000000 +0000
+++ new-ghc/patches/dll-split-fix.patch	2014-12-08 19:05:50.247627510 +0000
@@ -0,0 +1,193 @@
+commit 2a8ea4745d6ff79d6ce17961a64d9013243fc3c6
+Author: Sergei Trofimovich <slyfox at gentoo.org>
+Date:   Sat Oct 4 20:48:22 2014 +0100
+
+    ghc.mk: fix list for dll-split on GHCi-less builds
+    
+    To reproduce build failure it's enough to try
+    to build GHC on amd64 with the following setup:
+    
+        $ cat mk/build.mk
+        # for #9552
+        GhcWithInterpreter = NO
+    
+    It gives:
+    
+        Reachable modules from DynFlags out of date
+        Please fix compiler/ghc.mk, or building DLLs on Windows may break (#7780)
+        Redundant modules: Bitmap BlockId ... <list of 42 modules>
+        <make error>
+    
+    dll-split among other things makes sure
+    all mentioned modules are used by DynFlags.
+    '#ifdef GHCI' keeps is from happening.
+    
+    Patch moves those 42 modules under
+    'GhcWithInterpreter' guard.
+    
+    Fixes Issue #9552
+    
+    Signed-off-by: Sergei Trofimovich <slyfox at gentoo.org>
+
+Index: ghc-7.8.3.20141119/compiler/ghc.mk
+===================================================================
+--- ghc-7.8.3.20141119.orig/compiler/ghc.mk	2014-12-08 18:45:43.683249077 +0100
++++ ghc-7.8.3.20141119/compiler/ghc.mk	2014-12-08 18:45:43.683249077 +0100
+@@ -461,36 +461,15 @@
+ 	BasicTypes \
+ 	BinIface \
+ 	Binary \
+-	Bitmap \
+-	BlockId \
+ 	BooleanFormula \
+ 	BreakArray \
+ 	BufWrite \
+ 	BuildTyCl \
+-	ByteCodeAsm \
+-	ByteCodeInstr \
+-	ByteCodeItbls \
+-	CLabel \
+ 	Class \
+ 	CmdLineParser \
+-	Cmm \
+-	CmmCallConv \
+-	CmmExpr \
+-	CmmInfo \
+-	CmmMachOp \
+-	CmmNode \
+ 	CmmType \
+-	CmmUtils \
+ 	CoAxiom \
+ 	ConLike \
+-	CodeGen.Platform \
+-	CodeGen.Platform.ARM \
+-	CodeGen.Platform.NoRegs \
+-	CodeGen.Platform.PPC \
+-	CodeGen.Platform.PPC_Darwin \
+-	CodeGen.Platform.SPARC \
+-	CodeGen.Platform.X86 \
+-	CodeGen.Platform.X86_64 \
+ 	Coercion \
+ 	Config \
+ 	Constants \
+@@ -514,7 +493,6 @@
+ 	Exception \
+ 	ExtsCompat46 \
+ 	FamInstEnv \
+-	FastBool \
+ 	FastFunctions \
+ 	FastMutInt \
+ 	FastString \
+@@ -524,8 +502,6 @@
+ 	FiniteMap \
+ 	ForeignCall \
+ 	Hooks \
+-	Hoopl \
+-	Hoopl.Dataflow \
+ 	HsBinds \
+ 	HsDecls \
+ 	HsDoc \
+@@ -544,14 +520,12 @@
+ 	IfaceSyn \
+ 	IfaceType \
+ 	InstEnv \
+-	InteractiveEvalTypes \
+ 	Kind \
+ 	ListSetOps \
+ 	Literal \
+ 	LoadIface \
+ 	Maybes \
+ 	MkCore \
+-	MkGraph \
+ 	MkId \
+ 	Module \
+ 	MonadUtils \
+@@ -571,9 +545,6 @@
+ 	PipelineMonad \
+ 	Platform \
+ 	PlatformConstants \
+-	PprCmm \
+-	PprCmmDecl \
+-	PprCmmExpr \
+ 	PprCore \
+ 	PrelInfo \
+ 	PrelNames \
+@@ -581,23 +552,10 @@
+ 	Pretty \
+ 	PrimOp \
+ 	RdrName \
+-	Reg \
+-	RegClass \
+ 	Rules \
+-	SMRep \
+ 	Serialized \
+ 	SrcLoc \
+ 	StaticFlags \
+-	StgCmmArgRep \
+-	StgCmmClosure \
+-	StgCmmEnv \
+-	StgCmmLayout \
+-	StgCmmMonad \
+-	StgCmmProf \
+-	StgCmmTicky \
+-	StgCmmUtils \
+-	StgSyn \
+-	Stream \
+ 	StringBuffer \
+ 	TcEvidence \
+ 	TcIface \
+@@ -621,6 +579,54 @@
+ 	VarEnv \
+ 	VarSet
+ 
++ifeq "$(GhcWithInterpreter)" "YES"
++# These files are reacheable from DynFlags
++# only by GHCi-enabled code (see #9552)
++compiler_stage2_dll0_MODULES += \
++	Bitmap \
++	BlockId \
++	ByteCodeAsm \
++	ByteCodeInstr \
++	ByteCodeItbls \
++	CLabel \
++	Cmm \
++	CmmCallConv \
++	CmmExpr \
++	CmmInfo \
++	CmmMachOp \
++	CmmNode \
++	CmmUtils \
++	CodeGen.Platform \
++	CodeGen.Platform.ARM \
++	CodeGen.Platform.NoRegs \
++	CodeGen.Platform.PPC \
++	CodeGen.Platform.PPC_Darwin \
++	CodeGen.Platform.SPARC \
++	CodeGen.Platform.X86 \
++	CodeGen.Platform.X86_64 \
++	FastBool \
++	Hoopl \
++	Hoopl.Dataflow \
++	InteractiveEvalTypes \
++	MkGraph \
++	PprCmm \
++	PprCmmDecl \
++	PprCmmExpr \
++	Reg \
++	RegClass \
++	SMRep \
++	StgCmmArgRep \
++	StgCmmClosure \
++	StgCmmEnv \
++	StgCmmLayout \
++	StgCmmMonad \
++	StgCmmProf \
++	StgCmmTicky \
++	StgCmmUtils \
++	StgSyn \
++	Stream
++endif
++
+ compiler_stage2_dll0_HS_OBJS = \
+     $(patsubst %,compiler/stage2/build/%.$(dyn_osuf),$(subst .,/,$(compiler_stage2_dll0_MODULES)))
+ 
diff -rN -u old-ghc/patches/linker-detection-fix new-ghc/patches/linker-detection-fix
--- old-ghc/patches/linker-detection-fix	1970-01-01 00:00:00.000000000 +0000
+++ new-ghc/patches/linker-detection-fix	2014-12-08 19:05:50.247627510 +0000
@@ -0,0 +1,40 @@
+commit e7b414a3cc0e27049f2608f5e0a00c47146cc46d
+Author: Sebastian Dröge <sebastian at centricular.com>
+Date:   Tue Nov 18 12:40:20 2014 -0600
+
+    Fix detection of GNU gold linker if invoked via gcc with parameters
+    
+    Previously the linker was called without any commandline parameters to
+    detect whether bfd or gold is used. However the -fuse-ld parameter can
+    be used to switch between gold and bfd and should be taken into account
+    here.
+    
+    Trac #9336
+    
+    Signed-off-by: Austin Seipp <austin at well-typed.com>
+
+Index: ghc-7.8.3.20141119/compiler/main/SysTools.lhs
+===================================================================
+--- ghc-7.8.3.20141119.orig/compiler/main/SysTools.lhs	2014-12-08 18:45:13.829021078 +0100
++++ ghc-7.8.3.20141119/compiler/main/SysTools.lhs	2014-12-08 18:45:13.829021078 +0100
+@@ -739,7 +739,10 @@
+ getLinkerInfo' dflags = do
+   let platform = targetPlatform dflags
+       os = platformOS platform
+-      (pgm,_) = pgm_l dflags
++      (pgm,args0) = pgm_l dflags
++      args1     = map Option (getOpts dflags opt_l)
++      args2     = args0 ++ args1
++      args3     = filter notNull (map showOpt args2)
+ 
+       -- Try to grab the info from the process output.
+       parseLinkerInfo stdo _stde _exitc
+@@ -790,7 +793,7 @@
+                  -- In practice, we use the compiler as the linker here. Pass
+                  -- -Wl,--version to get linker version info.
+                  (exitc, stdo, stde) <- readProcessEnvWithExitCode pgm
+-                                        ["-Wl,--version"]
++                                        (["-Wl,--version"] ++ args3)
+                                         en_locale_env
+                  -- Split the output by lines to make certain kinds
+                  -- of processing easier. In particular, 'clang' and 'gcc'
diff -rN -u old-ghc/patches/series new-ghc/patches/series
--- old-ghc/patches/series	2014-12-08 19:05:50.231627511 +0000
+++ new-ghc/patches/series	2014-12-08 19:05:50.271627506 +0000
@@ -5,3 +5,6 @@
 Fix-documentation-build-failure-without-GHCi.patch
 arm64.patch
 mips-support.patch
+always_build_arm_spinlocks.patch
+linker-detection-fix
+dll-split-fix.patch




More information about the Pkg-haskell-commits mailing list