Hello community,

here is the log from the commit of package ghc for openSUSE:Factory checked in 
at 2014-11-26 10:32:51
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc (Old)
 and      /work/SRC/openSUSE:Factory/.ghc.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "ghc"

Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc/ghc.changes  2014-09-23 10:42:41.000000000 
+0200
+++ /work/SRC/openSUSE:Factory/.ghc.new/ghc.changes     2014-11-26 
10:32:55.000000000 +0100
@@ -1,0 +2,60 @@
+Wed Nov  5 17:10:14 UTC 2014 - [email protected]
+
+- add patch D349.patch
+* fix a crash with dynamic linking in GHCi when accessing the
+  process environment
+* our patch has been submitted upstream
+* see https://phabricator.haskell.org/D349
+
+-------------------------------------------------------------------
+Sun Sep 28 07:56:51 UTC 2014 - [email protected]
+
+- ghc-rpm-macros use internal dependency generator now
+* simplifies spec file 
+
+-------------------------------------------------------------------
+Sat Sep 20 13:09:30 UTC 2014 - [email protected]
+
+- fix alternatives handling 
+
+-------------------------------------------------------------------
+Fri Sep 19 09:17:53 UTC 2014 - [email protected]
+
+- update to 7.8.3
+* needed for Haskell Platfoerm 2014.2.0.0
+* fixes bnc #726744
+* way smaller source tarball (windows binaries removed)
+* dynamic libraries, GHCi, and Template Haskell for ppc64 and ppc64le
+- drop ghc-ppc64le.patch (fixed upstream)
+- add integer-gmp.patch
+* build bundled libgmp on SLE 11 (system version is too old)
+* fixes build on x86_64
+* see upstream trac #8156
+- add ghc-7.8.2-cgen-constify.patch
+* C backend (ppc64, ppc64le): generate 'const' strings
+* reduce size of table of contents (TOC)
+- add D173.patch
+* fix C backend: generate literals of correct size
+* fixes lots of arithmetic failures and trac #8849
+* asked upstream to merge fix into 7.8.4
+- add D177.patch
+* pass PIC flags to assembler
+* shared libraries on ppc still broken (trac #8024)
+- add ghc.git-e18525f.patch
+* fix C backend: generate functions for cmm primitives
+- drop ghc-use-system-libffi.patch (included upstream)
+- drop ghc-suse-as-needed.patch (fixed upstream)
+- drop Cabal-fix-dynamic-exec-for-TH.patch (fixed upstream)
+- drop ghc-7.6.3-LlvmCodeGen-no-3.3-warning.patch (fixed upstream)
+- drop ghc-avoid-empty-llvm-used-definitions.patch (fixed upstream)
+- drop 0001-Fix-detection-of-library-for-shm-on-openSUSE.patch
+* our patch was included upstream
+- drop 0001-Delete-spurious-comma-in-configure.ac.patch
+* our patch was included upstream
+-drop ghc-fix-infinite-loop-big-endian.patch (fixed upstream
+- refresh llvm-powerpc64-datalayout.patch
+* port to new LLVM backend
+- refresh ghc-cabal-unversion-docdir.patch
+* include original Fedora patch for 7.8.2
+
+-------------------------------------------------------------------

Old:
----
  0001-Delete-spurious-comma-in-configure.ac.patch
  0001-Fix-detection-of-library-for-shm-on-openSUSE.patch
  Cabal-fix-dynamic-exec-for-TH.patch
  ghc-7.6.3-LlvmCodeGen-no-3.3-warning.patch
  ghc-7.6.3-src.tar.bz2
  ghc-avoid-empty-llvm-used-definitions.patch
  ghc-fix-infinite-loop-big-endian.patch
  ghc-ppc64le.patch
  ghc-suse-as-needed.patch
  ghc-use-system-libffi.patch

New:
----
  D173.patch
  D177.patch
  D349.patch
  ghc-7.8.2-cgen-constify.patch
  ghc-7.8.3-src.tar.xz
  ghc.git-e18525f.patch
  integer-gmp.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ ghc.spec ++++++
--- /var/tmp/diff_new_pack.vrQA4V/_old  2014-11-26 10:32:58.000000000 +0100
+++ /var/tmp/diff_new_pack.vrQA4V/_new  2014-11-26 10:32:58.000000000 +0100
@@ -18,12 +18,8 @@
 
 %global unregisterised_archs ppc64 ppc64le s390 s390s
 
-%ifarch %{unregisterised_archs}
-%global ghc_without_shared 1
-%endif
-
 Name:           ghc
-Version:        7.6.3
+Version:        7.8.3
 Release:        0
 Url:            
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2
 Summary:        The Glorious Glasgow Haskell Compiler
@@ -31,11 +27,9 @@
 Group:          Development/Languages/Other
 ExclusiveArch:  %{ix86} x86_64 ppc ppc64 ppc64le
 
-BuildRequires:  ghc-bootstrap >= 7.0
-BuildRequires:  autoconf
-BuildRequires:  automake
 BuildRequires:  binutils-devel
 BuildRequires:  gcc
+BuildRequires:  ghc-bootstrap >= 7.4
 BuildRequires:  ghc-rpm-macros-extra
 BuildRequires:  glibc-devel
 BuildRequires:  gmp-devel
@@ -43,6 +37,7 @@
 BuildRequires:  libffi-devel
 BuildRequires:  ncurses-devel
 BuildRequires:  pkg-config
+BuildRequires:  xz
 %if %{undefined without_manual}
 %if 0%{suse_version} >= 1220
 BuildRequires:  dblatex
@@ -51,33 +46,29 @@
 BuildRequires:  docbook-xsl-stylesheets
 BuildRequires:  libxslt
 %endif
+
 PreReq:         update-alternatives
 Requires:       ghc-compiler = %{version}-%{release}
 Requires:       ghc-ghc-devel = %{version}-%{release}
 Requires:       ghc-libraries = %{version}-%{release}
-Source:         
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.bz2
+Source:         
http://haskell.org/ghc/dist/%{version}/%{name}-%{version}-src.tar.xz
 Source1:        ghc-rpmlintrc
-# PATCH-FIX-UPSTREAM ghc-use-system-libffi.patch 
[email protected] - See Haskell trac #4496 and #5743; backport 
of our patch accepted upstream for next major release.
-Patch:          ghc-use-system-libffi.patch
-# PATCH-FIX-UPSTREAM ghc-suse-as-needed.patch [email protected] 
- temporary fix for Haskell trac #7062, ghc libraries do not work with 
as_needed and new-dtags both enabled
-Patch1:         ghc-suse-as-needed.patch
-# PATCH-FIX-UPSTREAM Cabal-fix-dynamic-exec-for-TH.patch 
[email protected] - Fedora patch 10
-Patch2:         Cabal-fix-dynamic-exec-for-TH.patch
-# PATCH-FIX-UPSTREAM ghc-7.6.3-LlvmCodeGen-no-3.3-warning.patch 
[email protected] - Fedora patch 14: Silence warning about llvm 
3.3
-Patch3:         ghc-7.6.3-LlvmCodeGen-no-3.3-warning.patch
-# PATCH-FIX-UPSTREAM ghc-avoid-empty-llvm-used-definitions.patch 
[email protected] - Backport of commit db9b63105a54, fixes 
Haskell trac #7996
-Patch4:         ghc-avoid-empty-llvm-used-definitions.patch
-# PATCH-FIX-UPSTREAM 0001-Fix-detection-of-library-for-shm-on-openSUSE.patch 
[email protected] - Fix test for librt and shm_* detection. 
Backported patch sent upstream 2013-09-24, Haskell trac #8350.
-Patch5:         0001-Fix-detection-of-library-for-shm-on-openSUSE.patch
-# PATCH-FIX-UPSTREAM 0001-Delete-spurious-comma-in-configure.ac.patch 
[email protected] - Fix test for setitimer. Backported patch 
sent upstream 2013-09-24, Haskell trac #8352
-Patch6:         0001-Delete-spurious-comma-in-configure.ac.patch
-# PATCH-FIX-UPSTREAM [email protected] - Fix Haskell trac #8134.
-Patch7:         ghc-fix-infinite-loop-big-endian.patch
-# PATCH-FIX-UPSTREAM [email protected] - Add target datalayout 
for llvm on powerpc 64.
+# PATCH-FIX-UPSTREAM llvm-powerpc64-datalayout.patch 
[email protected] - Add target datalayout for llvm on powerpc 64.
 Patch8:         llvm-powerpc64-datalayout.patch
-# PATCH-FIX-OPENSUSE [email protected] - Remove versions in 
library docdirs. Required for compatibility with ghc-rpm-macros 1.0 and up. Can 
be removed once we move to ghc 7.8.x. Fedora patch 16.
+# PATCH-FIX-OPENSUSE ghc-cabal-unversion-docdir.patch 
[email protected] - Remove versions in library docdirs. Required 
for compatibility with ghc-rpm-macros 1.0 and up. Can be removed once we move 
to ghc 7.8.x. Fedora patch 16.
 Patch9:         ghc-cabal-unversion-docdir.patch
-Patch10:        ghc-ppc64le.patch
+# PATCH-FIX-UPSTREAM D349.patch [email protected] - Fix dynamic 
linker, see Haskell trac #8935.
+Patch12:        D349.patch
+# PATCH-FIX-UPSTREAM integer-gmp.patch [email protected] -- 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 
[email protected] - 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 D173.patch [email protected] -- Fix C 
backend. Backport of upstream fix for 7.10. See 
https://phabricator.haskell.org/D173.
+Patch15:        D173.patch
+# PATCH-FIX-UPSTREAM D177.patch [email protected] -- Pass PIC 
flags to assembler. See https://phabricator.haskell.org/D177.
+Patch16:        D177.patch
+# PATCH-FIX-UPSTREAM ghc.git-e18525f.patch [email protected] -- 
Declare extern cmm primitives as functions not data. Backport of upstream fix 
for 7.10. See 
https://git.haskell.org/ghc.git/commitdiff_plain/e18525fae273f4c1ad8d6cbe1dea4fc074cac721.
+Patch17:        ghc.git-e18525f.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
 
@@ -118,37 +109,36 @@
 
 %global ghc_version_override %{version}
 
-
-%global _use_internal_dependency_generator 0
-%global __find_provides %{_rpmconfigdir}/ghc-deps.sh --provides 
%{buildroot}%{ghclibdir}
-%global __find_requires %{_rpmconfigdir}/ghc-deps.sh --requires 
%{buildroot}%{ghclibdir}
-
 %global ghc_pkg_c_deps ghc-compiler = %{ghc_version_override}-%{release}
 
 %if %{defined ghclibdir}
-%ghc_lib_subpackage Cabal 1.16.0
-%ghc_lib_subpackage array 0.4.0.1
-%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.6.0.1
-%ghc_lib_subpackage binary 0.5.1.1
-%ghc_lib_subpackage bytestring 0.10.0.2
-%ghc_lib_subpackage containers 0.5.0.0
-%ghc_lib_subpackage deepseq 1.3.0.1
-%ghc_lib_subpackage directory 1.2.0.1
-%ghc_lib_subpackage filepath 1.3.0.1
+%ghc_lib_subpackage Cabal 1.18.1.3
+%ghc_lib_subpackage array 0.5.0.0
+%ghc_lib_subpackage -c gmp-devel,libffi-devel base 4.7.0.1
+%ghc_lib_subpackage binary 0.7.1.0
+%ghc_lib_subpackage bytestring 0.10.4.0
+%ghc_lib_subpackage containers 0.5.5.1
+%ghc_lib_subpackage deepseq 1.3.0.2
+%ghc_lib_subpackage directory 1.2.1.0
+%ghc_lib_subpackage filepath 1.3.0.2
 %define ghc_pkg_obsoletes ghc-bin-package-db-devel < 0.0.0.0-%{release}
 %ghc_lib_subpackage -x ghc %{ghc_version_override}
 %undefine ghc_pkg_obsoletes
-%ghc_lib_subpackage haskell2010 1.1.1.0
-%ghc_lib_subpackage haskell98 2.0.0.2
-%ghc_lib_subpackage hoopl 3.9.0.0
-%ghc_lib_subpackage hpc 0.6.0.0
-%ghc_lib_subpackage old-locale 1.0.0.5
-%ghc_lib_subpackage old-time 1.1.0.1
-%ghc_lib_subpackage pretty 1.1.1.0
-%ghc_lib_subpackage process 1.1.0.2
-%ghc_lib_subpackage template-haskell 2.8.0.0
-%ghc_lib_subpackage time 1.4.0.1
-%ghc_lib_subpackage unix 2.6.0.1
+%ghc_lib_subpackage haskeline 0.7.1.2
+%ghc_lib_subpackage haskell2010 1.1.2.0
+%ghc_lib_subpackage haskell98 2.0.0.3
+%ghc_lib_subpackage hoopl 3.10.0.1
+%ghc_lib_subpackage hpc 0.6.0.1
+%ghc_lib_subpackage old-locale 1.0.0.6
+%ghc_lib_subpackage old-time 1.1.0.2
+%ghc_lib_subpackage pretty 1.1.1.1
+%ghc_lib_subpackage process 1.2.0.0
+%ghc_lib_subpackage template-haskell 2.9.0.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
 %endif
 
 %global version %{ghc_version_override}
@@ -169,42 +159,43 @@
 
 %prep
 %setup -q
-rm -r ghc-tarballs/{mingw,mingw64,perl}
-%patch -p1 -b .libffi
-rm -r ghc-tarballs/libffi
-%patch1 -p1 -b .suse
-%patch2 -p1 -b .TH
-%patch3 -p1 -b .llvm-version
-%patch4 -p1 -b .llvm-empty
-%patch5 -p1 -b .shm
-%patch6 -p1 -b .comma
-%patch7 -p1
 %patch8 -p1
 %patch9 -p1
-%patch10 -p1
+%patch12 -p1
+%patch13 -p1
+%patch14 -p1
+%patch15 -p1
+%patch16 -p1
+%patch17 -p1
 
 %build
-# required for patch and patch1
-#autoreconf -fi
-
-# required for patch5 and patch6 and will run autoreconf for patch and patch1
-perl boot
-
 # Check if bootstrap is required, i.e. version is different from ghc's version
 # Note: Cannot use ghc_version macro here as we defined version override 
earlier
 %if "%version" != "%(ghc --numeric-version)"
 %define ghc_boot 1
 cat > mk/build.mk <<EOF
-GhcLibWays = v
+GhcLibWays = v %{!?ghc_without_shared:dyn}
+%if %{defined ghc_without_shared}
+DYNAMIC_BY_DEFAULT   = NO
+DYNAMIC_GHC_PROGRAMS = NO
+%endif
 %ifarch %{unregisterised_archs}
-GhcUnregisterised=YES
+GhcUnregisterised    = YES
+GhcWithNativeCodeGen = NO
+GhcWithInterpreter   = YES
+SRC_HC_OPTS          = -O -H64m
+GhcStage1HcOpts      = -O
+GhcStage2HcOpts      = -O
+GhcHcOpts            = -Rghc-timing
+GhcLibHcOpts         = -O
+SRC_HC_OPTS         += -optc-fno-builtin
+SRC_CC_OPTS         += -fno-builtin
 %endif
 HADDOCK_DOCS = NO
 BUILD_DOCBOOK_HTML = NO
 HSCOLOUR_SRCS = NO
 EOF
-./configure --prefix=%{_builddir}/ghc-boot --with-system-libffi \
-  --with-gcc=%{_bindir}/gcc
+./configure --prefix=%{_builddir}/ghc-boot --with-system-libffi
 make %{?_smp_mflags}
 make install
 make clean
@@ -221,15 +212,20 @@
 # override some settings
 cat >> mk/build.mk << EOF
 GhcLibWays = v %{!?ghc_without_shared:dyn} %{!?without_prof:p}
+%if %{defined ghc_without_shared}
+DYNAMIC_BY_DEFAULT   = NO
+DYNAMIC_GHC_PROGRAMS = NO
+%endif
 %ifarch  %{unregisterised_archs}
 GhcUnregisterised    = YES
 GhcWithNativeCodeGen = NO
 SRC_HC_OPTS          = -O -H64m
 GhcStage1HcOpts      = -O
-GhcStage2HcOpts      = -O2
+GhcStage2HcOpts      = -O
 GhcHcOpts            = -Rghc-timing
-GhcLibHcOpts         = -O2
-SplitObjs            = NO
+GhcLibHcOpts         = -O
+SRC_HC_OPTS         += -optc-fno-builtin
+SRC_CC_OPTS         += -fno-builtin
 %endif
 %if %{defined without_haddock}
 HADDOCK_DOCS = NO
@@ -249,8 +245,7 @@
   --libexecdir=%{_libexecdir} --localstatedir=%{_localstatedir} \
   --sharedstatedir=%{_sharedstatedir} --mandir=%{_mandir} \
   %{?ghc_boot:--with-ghc=%{_builddir}/ghc-boot/bin/ghc} \
-  --with-system-libffi \
-  --with-gcc=%{_bindir}/gcc
+  --with-system-libffi
 
 make %{?_smp_mflags}
 
@@ -270,8 +265,8 @@
 
 %ghc_gen_filelists bin-package-db 0.0.0.0
 %ghc_gen_filelists ghc %{ghc_version_override}
-%ghc_gen_filelists ghc-prim 0.3.0.0
-%ghc_gen_filelists integer-gmp 0.5.0.0
+%ghc_gen_filelists ghc-prim 0.3.1.0
+%ghc_gen_filelists integer-gmp 0.5.1.0
 
 %define merge_filelist()\
 cat ghc-%1.files >> ghc-%2.files\
@@ -284,20 +279,24 @@
 %merge_filelist bin-package-db ghc
 
 %if %{undefined ghc_without_shared}
-ls %{buildroot}%{ghclibdir}/libHS*.so >> ghc-base.files
+echo %%dir %{ghclibdir}/rts-1.0 >> ghc-base.files
+ls %{buildroot}%{ghclibdir}/rts-1.0/libHS*.so >> ghc-base.files
 sed -i -e "s|^%{buildroot}||g" ghc-base.files
 %endif
-ls -d %{buildroot}%{ghclibdir}/libHS*.a  
%{buildroot}%{ghclibdir}/package.conf.d/builtin_*.conf 
%{buildroot}%{ghclibdir}/include >> ghc-base-devel.files
+echo %%dir %{ghclibdir}/rts-1.0 >> 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
 sed -i -e "s|^%{buildroot}||g" ghc-base-devel.files
 
 # these are handled as alternatives
+mkdir -p %{buildroot}%{_sysconfdir}/alternatives
 for i in hsc2hs runhaskell; do
   if [ -x %{buildroot}%{_bindir}/$i-ghc ]; then
     rm %{buildroot}%{_bindir}/$i
   else
     mv %{buildroot}%{_bindir}/$i{,-ghc}
   fi
-  touch %{buildroot}%{_bindir}/$i
+  ln -s -f %{_sysconfdir}/alternatives/$i %{buildroot}%{_bindir}/$i
+  touch %{buildroot}%{_sysconfdir}/alternatives/$i
 done
 
 %ghc_strip_dynlinked
@@ -320,8 +319,8 @@
 rm testghc/*
 %if %{undefined ghc_without_shared}
 echo 'main = putStrLn "Foo"' > testghc/foo.hs
-inplace/bin/ghc-stage2 testghc/foo.hs -o testghc/foo -dynamic
-[ "$(testghc/foo)" = "Foo" ]
+#inplace/bin/ghc-stage2 testghc/foo.hs -o testghc/foo -dynamic
+#[ "$(testghc/foo)" = "Foo" ]
 rm testghc/*
 %endif
 
@@ -337,13 +336,13 @@
 # groups under a single name 'runhaskell'. Either these tools should be
 # disentangled from the Haskell implementations or all implementations should
 # have the same set of tools. *sigh*
-update-alternatives --install %{_bindir}/runhaskell runhaskell 
%{_bindir}/runghc     500
-update-alternatives --install %{_bindir}/hsc2hs     hsc2hs     
%{_bindir}/hsc2hs-ghc 500
+"%_sbindir/update-alternatives" --install %{_bindir}/runhaskell runhaskell 
%{_bindir}/runghc     500
+"%_sbindir/update-alternatives" --install %{_bindir}/hsc2hs     hsc2hs     
%{_bindir}/hsc2hs-ghc 500
 
 %preun compiler
 if test "$1" = 0; then
-  update-alternatives --remove runhaskell %{_bindir}/runghc
-  update-alternatives --remove hsc2hs     %{_bindir}/hsc2hs-ghc
+  "%_sbindir/update-alternatives" --remove runhaskell %{_bindir}/runghc
+  "%_sbindir/update-alternatives" --remove hsc2hs     %{_bindir}/hsc2hs-ghc
 fi
 
 %files
@@ -352,7 +351,7 @@
 
 %files compiler
 %defattr(-,root,root,-)
-%doc ANNOUNCE HACKING LICENSE README
+%doc ANNOUNCE LICENSE
 %{_bindir}/ghc
 %{_bindir}/ghc-%{version}
 %{_bindir}/ghc-pkg
@@ -361,43 +360,56 @@
 %{_bindir}/ghci-%{version}
 %{_bindir}/hp2ps
 %{_bindir}/hpc
-%ghost %attr(755,root,root) %{_bindir}/hsc2hs
+%{_bindir}/hsc2hs
+%if 0%{suse_version} >= 1220
+%ghost %{_sysconfdir}/alternatives/hsc2hs
+%endif
 %{_bindir}/hsc2hs-ghc
 %{_bindir}/runghc
 %{_bindir}/runghc-%{version}
-%ghost %attr(755,root,root) %{_bindir}/runhaskell
+%{_bindir}/runhaskell
+%if 0%{suse_version} >= 1220
+%ghost %{_sysconfdir}/alternatives/runhaskell
+%endif
 %{_bindir}/runhaskell-ghc
+%dir %{ghclibdir}
 %{ghclibdir}/settings
-%{ghclibdir}/ghc
-%{ghclibdir}/ghc-pkg
+%dir %{ghclibdir}/bin
+%{ghclibdir}/bin/ghc
+%{ghclibdir}/bin/ghc-pkg
+%{ghclibdir}/bin/hpc
+%{ghclibdir}/bin/hsc2hs
 %ifnarch %{unregisterised_archs}
 %{ghclibdir}/ghc-split
 %endif
 %{ghclibdir}/ghc-usage.txt
 %{ghclibdir}/ghci-usage.txt
-%{ghclibdir}/hsc2hs
+%{ghclibdir}/mkGmpDerivedConstants
 %dir %{ghclibdir}/package.conf.d
 %ghost %{ghclibdir}/package.conf.d/package.cache
-%{ghclibdir}/runghc
+%{ghclibdir}/platformConstants
+%{ghclibdir}/bin/runghc
 %{ghclibdir}/template-hsc.h
 %{ghclibdir}/unlit
 %dir %{_datadir}/doc/ghc
 %dir %{ghcdocbasedir}
 %dir %{ghcdocbasedir}/libraries
+%if %{undefined without_manual}
 %{_mandir}/man1/ghc.*
+%endif
 %if %{undefined without_haddock}
 %{_bindir}/haddock
 %{_bindir}/haddock-ghc-%{version}
 %{ghclibdir}/html
 %{ghclibdir}/latex
-%{ghclibdir}/haddock
+%{ghclibdir}/bin/haddock
 %if %{undefined without_manual}
-%if 0%{suse_version} >= 1220
-%{_datadir}/doc/ghc/haddock.*
-%{_datadir}/doc/ghc/users_guide.*
-%endif
 %{ghcdocbasedir}/haddock
 %{ghcdocbasedir}/users_guide
+%if 0%{suse_version} >= 1220
+%{_datadir}/doc/ghc/haddock*
+%{_datadir}/doc/ghc/users_guide*
+%endif
 %endif
 %{ghcdocbasedir}/libraries/frames.html
 %{ghcdocbasedir}/libraries/gen_contents_index
@@ -412,10 +424,6 @@
 %ghost %{ghcdocbasedir}/libraries/minus.gif
 %ghost %{ghcdocbasedir}/libraries/plus.gif
 %endif
-%if %{suse_version} >= 1230
-%ghost %{_sysconfdir}/alternatives/hsc2hs
-%ghost %{_sysconfdir}/alternatives/runhaskell
-%endif
 
 %files libraries
 %defattr(-,root,root,-)

++++++ D173.patch ++++++
Index: ghc-7.8.3/compiler/cmm/PprC.hs
===================================================================
--- ghc-7.8.3.orig/compiler/cmm/PprC.hs
+++ ghc-7.8.3/compiler/cmm/PprC.hs
@@ -1220,8 +1220,9 @@ commafy xs = hsep $ punctuate comma xs
 pprHexVal :: Integer -> Width -> SDoc
 pprHexVal 0 _ = ptext (sLit "0x0")
 pprHexVal w rep
-  | w < 0     = parens (char '-' <> ptext (sLit "0x") <> go (-w) <> repsuffix 
rep)
-  | otherwise = ptext (sLit "0x") <> go w <> repsuffix rep
+  | w < 0     = parens (char '-' <>
+                    ptext (sLit "0x") <> intToDoc (-w) <> repsuffix rep)
+  | otherwise =     ptext (sLit "0x") <> intToDoc   w  <> repsuffix rep
   where
         -- type suffix for literals:
         -- Integer literals are unsigned in Cmm/C.  We explicitly cast to
@@ -1236,10 +1237,33 @@ pprHexVal w rep
           else panic "pprHexVal: Can't find a 64-bit type"
       repsuffix _ = char 'U'
 
+      intToDoc :: Integer -> SDoc
+      intToDoc i = go (truncInt i)
+
+      -- We need to truncate value as Cmm backend does not drop
+      -- redundant bits to ease handling of negative values.
+      -- Thus the following Cmm code on 64-bit arch, like amd64:
+      --     CInt v;
+      --     v = {something};
+      --     if (v == %lobits32(-1)) { ...
+      -- leads to the following C code:
+      --     StgWord64 v = (StgWord32)({something});
+      --     if (v == 0xFFFFffffFFFFffffU) { ...
+      -- Such code is incorrect as it promotes both operands to StgWord64
+      -- and the whole condition is always false.
+      truncInt :: Integer -> Integer
+      truncInt i =
+          case rep of
+              W8  -> i `rem` (2^(8 :: Int))
+              W16 -> i `rem` (2^(16 :: Int))
+              W32 -> i `rem` (2^(32 :: Int))
+              W64 -> i `rem` (2^(64 :: Int))
+              _   -> panic ("pprHexVal/truncInt: C backend can't encode "
+                            ++ show rep ++ " literals")
+
       go 0 = empty
       go w' = go q <> dig
            where
              (q,r) = w' `quotRem` 16
              dig | r < 10    = char (chr (fromInteger r + ord '0'))
                  | otherwise = char (chr (fromInteger r - 10 + ord 'a'))
-
++++++ D177.patch ++++++
Index: ghc-7.8.3/compiler/main/DriverPipeline.hs
===================================================================
--- ghc-7.8.3.orig/compiler/main/DriverPipeline.hs
+++ ghc-7.8.3/compiler/main/DriverPipeline.hs
@@ -1208,6 +1208,7 @@ runPhase (RealPhase (As with_cpp)) input
 
         as_prog <- whichAsProg
         let cmdline_include_paths = includePaths dflags
+        let pic_c_flags = picCCOpts dflags
 
         next_phase <- maybeMergeStub
         output_fn <- phaseOutputFilename next_phase
@@ -1221,6 +1222,9 @@ runPhase (RealPhase (As with_cpp)) input
                 = liftIO $ as_prog dflags
                        ([ SysTools.Option ("-I" ++ p) | p <- 
cmdline_include_paths ]
 
+                       -- See Note [-fPIC for assembler]
+                       ++ map SysTools.Option pic_c_flags
+
         -- We only support SparcV9 and better because V8 lacks an atomic CAS
         -- instruction so we have to make sure that the assembler accepts the
         -- instruction set. Note that the user can still override this
@@ -1262,6 +1266,8 @@ runPhase (RealPhase SplitAs) _input_fn d
             osuf = objectSuf dflags
             split_odir  = base_o ++ "_" ++ osuf ++ "_split"
 
+        let pic_c_flags = picCCOpts dflags
+
         -- this also creates the hierarchy
         liftIO $ createDirectoryIfMissing True split_odir
 
@@ -1295,6 +1301,9 @@ runPhase (RealPhase SplitAs) _input_fn d
                            then [SysTools.Option "-mcpu=v9"]
                            else []) ++
 
+                          -- See Note [-fPIC for assembler]
+                          map SysTools.Option pic_c_flags ++
+
                           [ SysTools.Option "-c"
                           , SysTools.Option "-o"
                           , SysTools.FileOption "" (split_obj n)
@@ -2210,3 +2219,38 @@ haveRtsOptsFlags dflags =
          isJust (rtsOpts dflags) || case rtsOptsEnabled dflags of
                                         RtsOptsSafeOnly -> False
                                         _ -> True
+
+-- Note [-fPIC for assembler]
+-- When compiling .c source file GHC's driver pipeline basically
+-- does the following two things:
+--   1. ${CC}              -S 'PIC_CFLAGS' source.c
+--   2. ${CC} -x assembler -c 'PIC_CFLAGS' source.S
+--
+-- Why do we need to pass 'PIC_CFLAGS' both to C compiler and assembler?
+-- Because on some architectures (at least sparc32) assembler also choses
+-- relocation type!
+-- Consider the following C module:
+--
+--     /* pic-sample.c */
+--     int v;
+--     void set_v (int n) { v = n; }
+--     int  get_v (void)  { return v; }
+--
+--     $ gcc -S -fPIC pic-sample.c
+--     $ gcc -c       pic-sample.s -o pic-sample.no-pic.o # incorrect binary
+--     $ gcc -c -fPIC pic-sample.s -o pic-sample.pic.o    # correct binary
+--
+--     $ objdump -r -d pic-sample.pic.o    > pic-sample.pic.o.od
+--     $ objdump -r -d pic-sample.no-pic.o > pic-sample.no-pic.o.od
+--     $ diff -u pic-sample.pic.o.od pic-sample.no-pic.o.od
+--
+-- Most of architectures won't show any difference in this test, but on sparc32
+-- the following assembly snippet:
+--
+--    sethi   %hi(_GLOBAL_OFFSET_TABLE_-8), %l7
+--
+-- generates two kinds or relocations, only 'R_SPARC_PC22' is correct:
+--
+--       3c:  2f 00 00 00     sethi  %hi(0), %l7
+--    -                       3c: R_SPARC_PC22        _GLOBAL_OFFSET_TABLE_-0x8
+--    +                       3c: R_SPARC_HI22        _GLOBAL_OFFSET_TABLE_-0x8
++++++ D349.patch ++++++
Index: ghc-7.8.3/compiler/ghci/Linker.lhs
===================================================================
--- ghc-7.8.3.orig/compiler/ghci/Linker.lhs
+++ ghc-7.8.3/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.3/compiler/main/SysTools.lhs
===================================================================
--- ghc-7.8.3.orig/compiler/main/SysTools.lhs
+++ ghc-7.8.3/compiler/main/SysTools.lhs
@@ -1365,6 +1365,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
@@ -1482,8 +1483,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.3/rts/Linker.c
===================================================================
--- ghc-7.8.3.orig/rts/Linker.c
+++ ghc-7.8.3/rts/Linker.c
@@ -1776,7 +1776,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) {
@@ -1786,11 +1786,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 -------------------
@@ -1798,14 +1799,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) {
@@ -1813,7 +1839,6 @@ internal_dlsym(void *hdl, const char *sy
             return v;
         }
     }
-    v = dlsym(hdl, symbol);
     RELEASE_LOCK(&dl_mutex);
     return v;
 }
@@ -1981,7 +2006,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
@@ -1995,7 +2020,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);
++++++ ghc-7.8.2-cgen-constify.patch ++++++
commit b0cf3ab7a69b878a4335d21a347b56e4b0ca0b7b
Author: Sergei Trofimovich <[email protected]>
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 <[email protected]>

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,
++++++ ghc-cabal-unversion-docdir.patch ++++++
--- /var/tmp/diff_new_pack.vrQA4V/_old  2014-11-26 10:32:58.000000000 +0100
+++ /var/tmp/diff_new_pack.vrQA4V/_new  2014-11-26 10:32:58.000000000 +0100
@@ -1,13 +1,15 @@
---- ghc-7.6.3/utils/ghc-cabal/Main.hs~ 2013-04-19 06:22:47.000000000 +0900
-+++ ghc-7.6.3/utils/ghc-cabal/Main.hs  2013-10-29 12:35:18.916340631 +0900
-@@ -180,8 +180,8 @@
-                             libsubdir = toPathTemplate "$pkgid",
-                             docdir    = toPathTemplate $
-                                             if relocatableBuild
--                                            then 
"$topdir/../doc/html/libraries/$pkgid"
--                                            else (myDocdir </> "$pkgid"),
-+                                            then 
"$topdir/../doc/html/libraries/$pkg"
-+                                            else (myDocdir </> "$pkg"),
-                             htmldir   = toPathTemplate "$docdir"
-                         }
-                 progs = withPrograms lbi
+Index: ghc-7.7.20131120/utils/ghc-cabal/Main.hs
+===================================================================
+--- ghc-7.7.20131120.orig/utils/ghc-cabal/Main.hs
++++ ghc-7.7.20131120/utils/ghc-cabal/Main.hs
+@@ -253,8 +253,8 @@ updateInstallDirTemplates relocatableBui
+           libsubdir = toPathTemplate "$pkgid",
+           docdir    = toPathTemplate $
+                           if relocatableBuild
+-                          then "$topdir/../doc/html/libraries/$pkgid"
+-                          else (myDocdir </> "$pkgid"),
++                          then "$topdir/../doc/html/libraries/$pkg"
++                          else (myDocdir </> "$pkg"),
+           htmldir   = toPathTemplate "$docdir"
+       }
+ 

++++++ ghc.git-e18525f.patch ++++++
From: Sergei Trofimovich <[email protected]>
Date: Thu, 4 Sep 2014 14:50:45 +0000 (+0300)
Subject: pprC: declare extern cmm primitives as functions, not data
X-Git-Url: 
https://git.haskell.org/ghc.git/commitdiff_plain/e18525fae273f4c1ad8d6cbe1dea4fc074cac721

pprC: declare extern cmm primitives as functions, not data

Summary:
  The commit fixes incorrect code generation of
  integer-gmp package on ia64 due to C prototypes mismatch.
  Before the patch prototypes for "foreign import prim" were:
      StgWord poizh[];
  After the patch they became:
      StgFunPtr poizh();

Long story:

Consider the following simple example:

    {-# LANGUAGE MagicHash, GHCForeignImportPrim, UnliftedFFITypes #-}
    module M where
    import GHC.Prim -- Int#
    foreign import prim "poizh" poi# :: Int# -> Int#

Before the patch unregisterised build generated the
following 'poizh' reference:
    EI_(poizh); /* StgWord poizh[]; */
    FN_(M_poizh_entry) {
    // ...
    JMP_((W_)&poizh);
    }

After the patch it looks this way:
    EF_(poizh); /* StgFunPtr poizh(); */
    FN_(M_poizh_entry) {
    // ...
    JMP_((W_)&poizh);
    }

On ia64 it leads to different relocation types being generated:
  incorrect one:
    addl r14 = @ltoffx(poizh#)
    ld8.mov r14 = [r14], poizh# ; r14 = address-of 'poizh#'
  correct one:
    addl r14 = @ltoff(@fptr(poizh#)), gp ; r14 = address-of-thunk 'poizh#'
    ld8 r14 = [r14]

'@fptr(poizh#)' basically instructs assembler to creates
another obect consisting of real address to 'poizh' instructions
and module address. That '@fptr' object is used as a function "address"
This object is different for every module referencing 'poizh' symbol.

All indirect function calls expect '@fptr' object. That way
call site reads real destination address and set destination
module address in 'gp' register from '@fptr'.

Signed-off-by: Sergei Trofimovich <[email protected]>
---

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
@@ -801,6 +801,7 @@ labelType (CmmLabel _ _ CmmClosure)
 labelType (CmmLabel _ _ CmmCode)                = CodeLabel
 labelType (CmmLabel _ _ CmmInfo)                = DataLabel
 labelType (CmmLabel _ _ CmmEntry)               = CodeLabel
+labelType (CmmLabel _ _ CmmPrimCall)            = CodeLabel
 labelType (CmmLabel _ _ CmmRetInfo)             = DataLabel
 labelType (CmmLabel _ _ CmmRet)                 = CodeLabel
 labelType (RtsLabel (RtsSelectorInfoTable _ _)) = DataLabel
++++++ integer-gmp.patch ++++++
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/
++++++ llvm-powerpc64-datalayout.patch ++++++
--- /var/tmp/diff_new_pack.vrQA4V/_old  2014-11-26 10:32:58.000000000 +0100
+++ /var/tmp/diff_new_pack.vrQA4V/_new  2014-11-26 10:32:58.000000000 +0100
@@ -1,18 +1,14 @@
-Index: ghc-7.6.3/compiler/llvmGen/LlvmCodeGen/Ppr.hs
+Index: ghc-7.8.2/compiler/llvmGen/LlvmCodeGen/Ppr.hs
 ===================================================================
---- ghc-7.6.3.orig/compiler/llvmGen/LlvmCodeGen/Ppr.hs
-+++ ghc-7.6.3/compiler/llvmGen/LlvmCodeGen/Ppr.hs
-@@ -68,6 +68,13 @@ moduleLayout =
-     $+$ text "target triple = \"arm-unknown-linux-gnueabi\""
- #endif
- 
-+#elif defined (powerpc64_TARGET_ARCH)
-+
-+#if linux_TARGET_OS
-+    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\""
-+#endif
-+
- #else
-     -- FIX: Other targets
-     empty
+--- 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

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to