Skip to content

Commit

Permalink
dev-lang/ghc-7.8.4: backported support for gold (https://bugs.gentoo.…
Browse files Browse the repository at this point in the history
…org/536426)

Signed-off-by: Sergei Trofimovich <siarheit@google.com>
  • Loading branch information
trofi committed Jan 13, 2015
1 parent f58060c commit 3b14185
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 31 deletions.
7 changes: 5 additions & 2 deletions dev-lang/ghc/Manifest
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ DIST ghc-bin-7.4.2-ppc.tbz2 89396808 SHA256 ebf6083a1f3256a978a9408cffa2562e837b
DIST ghc-bin-7.4.2-ppc64.tbz2 105431655 SHA256 d0aecf47749a9862085aec6403f25197465d99a02a3c721dffd5314bf81d74eb SHA512 f220fb91b1856da37f72166fe050d4908049845eec03626d09c5b6e88701b0002835c3343c3584baf9f9d9efb5c7cbc210eb64c6eb711a58764d0fea92e8ac9f WHIRLPOOL e27022a72c254fd189995fd1b39629d5328927b83237ae4e61e97ab5efb5c451c92fe77f944c724bf9d14130d5a6cd2e0896a7cd6052de1ef7091531aa39fa0f
DIST ghc-bin-7.4.2-sparc.tbz2 121224130 SHA256 e5eaf1f31ddc4790e0226f0075236af340ec9674d98701452d5c51455ca1cb52 SHA512 a3647d82bbb36fe0ca55185ebc9479a264e785eb5a8a33be6c37b8a6cbcf8c55373374801c685eef004de78db5aa1c96760b2bedb2ca0ac9097d39fe286984e9 WHIRLPOOL d2d5f8c5abb001fb5425e68d3d26d941569b832c373e40b5a96aaa11f589db9e2b72eb1cbcf8df7b8d4473e2cc1c61498b284d8b006cc20822c3a203fd0fe2cd
DIST ghc-bin-7.4.2-x86-stable-glibc.tbz2 92394017 SHA256 2c42257a60aec03ae622c1a600cd210a6094f26ac310fbd307006e7f2260e2a4 SHA512 9e8ef72d2aeb5681e6bb71e2eb875587ddd51089cfc3443c33c69f93274a29e5680de4bf4884af05cd84f0e9cea13d66d20f1e89994460137910cbc987b64359 WHIRLPOOL 5722824af91f1191e6a38a8eb4696e765468e3bf54ad411b1d387ae4bcc7cd4cb772bdf2054d7013a3cff41feaaf5607f051b3c0d9f609ca19f1a1f92dd02586
DIST ghc-bin-7.6.3-alpha.tbz2 132175518 SHA256 c0a16219d1e270cb73e68d6d0b0fae08264fa308acceb876d2c4e7dea302e13d SHA512 944f8dfea78e54068bfeb8773e9b15d7e5e307c5cdef5d928e011ceaef3a9449950afc2b033508c496497e4f97d6acafc005ba097ed9fd18b978eae601cce6a7 WHIRLPOOL 16dfdc97b310038daced86f7ea93632e9f6e1879cfabd7e8a4f662358fe17074c060df1c864dca944a79d60c98f134cc31b335bfce3d89b8537001783803e7a9
DIST ghc-bin-7.6.3-amd64.tbz2 94441516 SHA256 3ef747e96a40c9d5021e88b8afee0a97838c27b00619d9187783d95279c31779 SHA512 89f6c693d83d6309a0e44fcc68e30279c858adb0a0ea9317dd168b2e632c22a8507da78ed953523f5d7156db98e06c6df56d6edc19c0c50b3941ea578263dc64 WHIRLPOOL 891dfbfc9d88fa579b6a837651f7cc6d9aecef8b8752ec7bcebbdfef2a6d8929d0edaceff27ec61d6160d36d1b0e8406b7829a04a858ed64210b5c57b9c98940
DIST ghc-bin-7.6.3-ia64.tbz2 158762376 SHA256 07234585032a319d769bdf2c748904e2a1ce170413f6f24e2a62b4ef9be6a05c SHA512 86b439432f446034a54af6e177a5dcbf32a523b004d41c22243be2acb412f5df2645f0adff6aa80ca3efffb905ffd4e70e6753c4735bc74ca8545ea00791699a WHIRLPOOL bddcf1ab380bdfcf4cccd2afe6248503199abfba127a2c97ca148d71a6a558607f7e3324d1ac3f2b7aeb812468bc76cef870e201642fb8298f2da15d3ebe200e
DIST ghc-bin-7.6.3-r1-alpha.tbz2 123486983 SHA256 fb6828d9dff7b90563cc7b3277ed38801907930aebd6042a7e5ba61e5f50db73 SHA512 7821bdf7490283dc062be090d224138dd34641e014cc6742edaa51dcc9cb1de9724d575955b596c9273b878dfe79023daf172b132b124f67567132649cf9a30d WHIRLPOOL 4e51a7e7f54fcb4aeb7a4ade4140533413348f9aacf04f683fe7cc5e20843dc6a95bdd6d79a995e5e1085747be9e584df6ada61430662f06eb600abae0c7eabd
DIST ghc-bin-7.6.3-r1-ia64.tbz2 154480728 SHA256 9a176312f796a189c0354deab9a7c446db274f75f40554963c2f86597a5951fb SHA512 2aa945cebcd3d0c26af5ddb53cf2002ec6d263d071173495905dd52898bd2ab6605370b0025554c1f6afbd28e276abc708708e4add9a9b8cb08b4bb39f8f50a1 WHIRLPOOL 6371531141e707618577e924c01102481a12d91e2c85e24694ba64f9b2545869c248999138146f63ca379a4243ccd0dfa322ea01a23d222b9757584787c5a899
DIST ghc-bin-7.6.3-r1-ppc.tbz2 91800558 SHA256 c9b2262957585c9f02136014aa05423e1b7674c8eb0731a6d991e400e053e33a SHA512 2a101a30a4324780f1a614e044ba614f9094cd57d026c56f2b3ba514ae049c26ce8e4acbc89e93229da451b6fbe05ba0980b500cdd785bb2bce968a60434403a WHIRLPOOL 3a3b7e1eb945be01ab195880c7709514d2d11d25bab12fc15c2257207da48a37e6d6d7699c9ed5c1cc32d01057240a4d795e43cdf9d9d2748a1d94b93fb283ed
DIST ghc-bin-7.6.3-r1-ppc64.tbz2 121213680 SHA256 7d820988a762dc56ec471c9fcb5510f2e0bb47560181aa7dea8a934e73952477 SHA512 17fb269a2eae326db927b8734cd8326061b059ecd50a377c51c37cd657380be1ae61964df299009259de6e4e00aa71a525a9224f8fa607d6cc7994c221848358 WHIRLPOOL 76e9664a535e6be54c5288be683959ab6aadafb04d03c5d2f08f8ee663868b3ed390e2a0c8e6d233a532af694709e03dc0f78d16dfe51b87e201655219da4704
DIST ghc-bin-7.6.3-r1-sparc.tbz2 121641337 SHA256 0fb31b9584c1c6caafb44a51158bfd3d85c28d2313f8201855f58c019a1692c0 SHA512 d71efc47769efb091f93cb288b54a1fadfd4184053149b1cd7c219a0c9c95ed97c32b101c712e20643fea12546357b70a11f2852bebeac2141e961a3e4bf8764 WHIRLPOOL 37d320e01d8e43ecba6e90f8d0a9c440d30ea31ff79d9094a8205d9ce892570f81b8641080034215fdddf71131de1acc364e2a485383af8346190c36201c1e91
DIST ghc-bin-7.6.3-x86.tbz2 93718672 SHA256 a55024f66a048437fcd6ef0f33cdb994a43628998a2f0fe4d094cc9ba83d1615 SHA512 624f2a3238dee15853018d45632d1363e42d34099a77e5e9ce5c8da976cb4c33578144f7c39dbf25ee68c17d8d42910db2347186849eeeda6bc20053ce2be990 WHIRLPOOL bc646fc19906b59416358fb7558b6e2c3f7ad069c2fcf443be36b621894cfcecb0844acf5b5f9c383e034dfff3e24d312a7da0d7a629836134ec5dc1ecd6f139
DIST ghc-bin-7.8.3-amd64.tbz2 100786052 SHA256 af49f547336a4f9f13cd625155d5a6a998e52ae7da8bbbddc856f88b00b6aff4 SHA512 b1826095b67fa2028678057f70909bff4e082b82f3b70f1aedbc91073efad54334fa1864bc8248c9249eec6edab3671dc38ac1650be86f1245e2fecf92528952 WHIRLPOOL 5b44fff77a0d79c6f7c5c8ca792eb6b36987d1de58d5ebc0a9b05da9c19a2c312eca6b9d40e7e63437742b7f9c28c925feb3bea7f9803dda95fac7acaa7a3132
DIST ghc-bin-7.8.3-x86.tbz2 102583755 SHA256 c67f0d2471e594b4fdfc5b219bb6b61e57e6ba75132aa3f63d171550af8cbe3c SHA512 badabbba2f46b5ab3a2601e53997ce6533162afeec7dc36eeb877a62680a9f599aeb05dd3682f45d3e273d71d28b8bd01eee37dcad3c7354e8f83b7be4e58536 WHIRLPOOL 7b99b6bbeb4ad6d203f270d8446285825ad0857a8ab058d8c126155b49e8819e0efc2f6c42b5ff775dc0ece5488e97fcc7ae2459fe87fdceef43d63a75443430
Expand Down
27 changes: 27 additions & 0 deletions dev-lang/ghc/files/ghc-7.8.4-gold.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Gentoo-bug: https://bugs.gentoo.org/536426
Reported-by: Eric Siegel
commit 021b7978d14799bae779907faf7490cfd21b3f46
Author: Austin Seipp <austin@well-typed.com>
Date: Sun Jul 20 10:13:15 2014 -0500

driver: use absolute paths in ld scripts (#7452)

Patch contributed by slowmo.

Signed-off-by: Austin Seipp <austin@well-typed.com>

diff --git a/compiler/main/DriverPipeline.hs b/compiler/main/DriverPipeline.hs
index 11427e2..49126fe 100644
--- a/compiler/main/DriverPipeline.hs
+++ b/compiler/main/DriverPipeline.hs
@@ -2166,7 +2166,9 @@ joinObjectFiles dflags o_files output_fn = do
if ldIsGnuLd
then do
script <- newTempName dflags "ldscript"
- writeFile script $ "INPUT(" ++ unwords o_files ++ ")"
+ cwd <- getCurrentDirectory
+ let o_files_abs = map (cwd </>) o_files
+ writeFile script $ "INPUT(" ++ unwords o_files_abs ++ ")"
ld_r [SysTools.FileOption "" script] ccInfo
else if sLdSupportsFilelist mySettings
then do
151 changes: 122 additions & 29 deletions dev-lang/ghc/ghc-7.6.3.ebuild → dev-lang/ghc/ghc-7.6.3-r1.ebuild
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Copyright 1999-2013 Gentoo Foundation
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-7.6.2.ebuild,v 1.1 2013/02/09 18:33:57 slyfox Exp $
# $Header: /var/cvsroot/gentoo-x86/dev-lang/ghc/ghc-7.6.3-r1.ebuild,v 1.15 2015/01/02 23:50:56 slyfox Exp $

# Brief explanation of the bootstrap logic:
#
Expand Down Expand Up @@ -41,7 +41,8 @@ if [[ ${CTARGET} = ${CHOST} ]] ; then
fi
fi

inherit base autotools bash-completion-r1 eutils flag-o-matic multilib toolchain-funcs ghc-package versionator pax-utils
inherit autotools bash-completion-r1 eutils flag-o-matic ghc-package
inherit multilib multiprocessing pax-utils toolchain-funcs versionator

DESCRIPTION="The Glasgow Haskell Compiler"
HOMEPAGE="http://www.haskell.org/ghc/"
Expand All @@ -50,13 +51,13 @@ HOMEPAGE="http://www.haskell.org/ghc/"
arch_binaries=""

# sorted!
arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-alpha.tbz2 )"
arch_binaries="$arch_binaries alpha? ( http://code.haskell.org/~slyfox/ghc-alpha/ghc-bin-${PV}-r1-alpha.tbz2 )"
#arch_binaries="$arch_binaries arm? ( http://code.haskell.org/~slyfox/ghc-arm/ghc-bin-${PV}-arm.tbz2 )"
arch_binaries="$arch_binaries amd64? ( http://code.haskell.org/~slyfox/ghc-amd64/ghc-bin-${PV}-amd64.tbz2 )"
arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-ia64.tbz2 )"
#arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-ppc.tbz2 )"
#arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-ppc64.tbz2 )"
#arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-sparc.tbz2 )"
arch_binaries="$arch_binaries ia64? ( http://code.haskell.org/~slyfox/ghc-ia64/ghc-bin-${PV}-r1-ia64.tbz2 )"
arch_binaries="$arch_binaries ppc? ( http://code.haskell.org/~slyfox/ghc-ppc/ghc-bin-${PV}-r1-ppc.tbz2 )"
arch_binaries="$arch_binaries ppc64? ( http://code.haskell.org/~slyfox/ghc-ppc64/ghc-bin-${PV}-r1-ppc64.tbz2 )"
arch_binaries="$arch_binaries sparc? ( http://code.haskell.org/~slyfox/ghc-sparc/ghc-bin-${PV}-r1-sparc.tbz2 )"
arch_binaries="$arch_binaries x86? ( http://code.haskell.org/~slyfox/ghc-x86/ghc-bin-${PV}-x86.tbz2 )"

# various ports:
Expand All @@ -72,9 +73,9 @@ yet_binary() {
#;;
amd64) return 0 ;;
ia64) return 0 ;;
#ppc) return 0 ;;
#ppc64) return 0 ;;
#sparc) return 0 ;;
ppc) return 0 ;;
ppc64) return 0 ;;
sparc) return 0 ;;
x86) return 0 ;;
*) return 1 ;;
esac
Expand All @@ -84,7 +85,7 @@ SRC_URI="!binary? ( http://www.haskell.org/ghc/dist/${PV}/${P}-src.tar.bz2 )"
[[ -n $arch_binaries ]] && SRC_URI+=" !ghcbootstrap? ( $arch_binaries )"
LICENSE="BSD"
SLOT="0/${PV}"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
KEYWORDS="~alpha amd64 ~ia64 ~ppc ~ppc64 ~sparc x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos ~sparc-solaris ~x86-solaris"
IUSE="doc ghcbootstrap ghcmakebinary +gmp llvm"
IUSE+=" binary" # don't forget about me later!
IUSE+=" elibc_glibc" # system stuff
Expand Down Expand Up @@ -122,6 +123,11 @@ PDEPEND="
# ia64 fails to return from STG GMP primitives (stage2 always SIGSEGVs)
REQUIRED_USE="ia64? ( !gmp )"

use binary && QA_PREBUILT="*"

# haskell libraries built with cabal in configure mode, #515354
QA_CONFIGURE_OPTIONS+=" --with-compiler --with-gcc"

is_crosscompile() {
[[ ${CHOST} != ${CTARGET} ]]
}
Expand Down Expand Up @@ -160,6 +166,9 @@ ghc_setup_cflags() {
strip-flags
strip-unsupported-flags

# Cmm can't parse line numbers #482086
replace-flags -ggdb[3-9] -ggdb2

GHC_FLAGS=""
for flag in ${CFLAGS}; do
case ${flag} in
Expand Down Expand Up @@ -408,7 +417,7 @@ src_prepare() {

cd "${S}" # otherwise epatch will break

epatch "${FILESDIR}/ghc-7.0.4-CHOST-prefix.patch"
epatch "${FILESDIR}"/${PN}-7.0.4-CHOST-prefix.patch

# epatch "${FILESDIR}"/${PN}-7.0.4-darwin8.patch
# failed to apply. FIXME
Expand All @@ -432,6 +441,10 @@ src_prepare() {

epatch "${FILESDIR}"/${PN}-7.4.1-ticket-7339-fix-unaligned-unreg.patch
epatch "${FILESDIR}"/${PN}-7.6.2-integer-simple-div-mod.patch
# ghc-7.8 changed linker code and likely fixed it
epatch "${FILESDIR}"/${PN}-7.6.3-trac-3333-weak-syms.patch
# bug 518734
epatch "${FILESDIR}"/${PN}-7.6.3-preserve-inplace-xattr.patch

if use prefix; then
# Make configure find docbook-xsl-stylesheets from Prefix
Expand Down Expand Up @@ -573,19 +586,32 @@ src_configure() {

src_compile() {
if ! use binary; then
#limit_jobs() {
# if [[ -n ${I_DEMAND_MY_CORES_LOADED} ]]; then
# ewarn "You have requested parallel build which is known to break."
# ewarn "Please report all breakages upstream."
# return
# fi
# echo $@
#}
limit_jobs() {
local user_jobs=$(makeopts_jobs)
local max_nonbreaking_jobs=$1

[[ ${user_jobs} -le ${max_nonbreaking_jobs} ]] && return

if [[ -n ${I_DEMAND_MY_CORES_LOADED} ]]; then
ewarn "You have requested parallel build which is known to break."
ewarn "Please report all breakages upstream."
return
else
ewarn "Limiting MAKEOPTS -j${user_jobs} -> -j${max_nonbreaking_jobs} (bug #456386)"
user_jobs=${max_nonbreaking_jobs}
fi
echo -j${user_jobs}
}
# ghc massively parallel make: #409631, #409873
# but let users screw it by setting 'I_DEMAND_MY_CORES_LOADED'
#emake $(limit_jobs -j1) all
# ^ above seems to be fixed.
emake all V=1
# 4 parallel jobs usually does not break

# 1. build compiler binary first
emake $(limit_jobs 4) ghc/stage2/build/tmp/ghc-stage2 V=1
# 2. pax-mark (bug #516430)
pax-mark -m ghc/stage2/build/tmp/ghc-stage2
# 3. and then all the rest
emake $(limit_jobs 4) all V=1

if is_crosscompile; then
# runghc does not work for a stage1 compiler, we can build it anyway
Expand All @@ -604,6 +630,76 @@ src_compile() {
fi # ! use binary
}

add-c_nonshared-to-ghci-libs() {
local ghci_lib
local nonshared_dir=${T}/libc_nonshared_objects

is_crosscompile && return
use elibc_glibc || return
use prefix && return

# we expect 'libc.a' bits be self-sufficient
if gcc-specs-pie; then
use x86 && return # but on x86 pie means linker support: #486140
fi

get-nonshared-objects() {
# ns - 'nonshared'
local ns_objects=" "
local ns_sym
local ns_srco
local ns_dsto

# extract
mkdir "${nonshared_dir}" || die
pushd "${nonshared_dir}" >/dev/null || die
$(tc-getAR) x "${ROOT}"/usr/$(get_libdir)/libc.a
popd >/dev/null || die

# they are mostly contents of /usr/$(get_libdir)/libc_nonstahed.a
# but 'c_nonstahed' contains PIC variants of symbols.
# ghci uses non-PIC ones
for ns_sym in \
stat fstat lstat mknod \
stat64 fstat64 lstat64 \
fstatat fstatat64 mknodat
do
ns_srco=${nonshared_dir}/${ns_sym}.o
ns_dsto=${nonshared_dir}/${ns_sym}_weakened.o
[[ -f ${ns_srco} ]] || continue
# here we do The Magic:
# 1. --keep-global-symbol= hides everything to adoid double definition
# of stuff like __stat, __fstat and
# 2. --weaken converts exported symbols to weak symbols to be available
# for redefinition
$(tc-getOBJCOPY) \
--weaken --keep-global-symbol=${ns_sym} \
"${ns_srco}" "${ns_dsto}" || die

ns_objects+=" ${ns_dsto}"
done

echo "${ns_objects}"
}
# bug #452442: when building libraries for ghci
# ghc basically glues them together:
# $ ld -r -o result foo.o bar.o ...
# that way some symbols defined in libc_nonshared.a
# do not get included into final HS*.o files
# We piggyback on one of early loaded wired-in library
# loaded before 'base'.
while read ghci_lib
do
einfo "relinking '${ghci_lib}' with c_includes"
mv "${ghci_lib}" "${ghci_lib}".unrelinked.o || die
$(tc-getLD) -r -o "${ghci_lib}" \
"${ghci_lib}".unrelinked.o \
$(get-nonshared-objects) || die
rm -r "${nonshared_dir}" || die
rm "${ghci_lib}".unrelinked.o || die
done < <(find "${ED}"/usr/$(get_libdir)/${P}/ -name 'HSghc-prim*.o')
}

src_install() {
if use binary; then
use prefix && mkdir -p "${ED}"
Expand Down Expand Up @@ -632,13 +728,10 @@ src_install() {
DESTDIR="${D}" \
|| die "make ${insttarget} failed"

# remove wrapper and linker
# remove wrapper and link
rm -f "${ED}"/usr/bin/haddock*

# ghci uses mmap with rwx protection at it implements dynamic
# linking on it's own (bug #299709)
# so mark resulting binary
pax-mark -m "${ED}/usr/$(get_libdir)/${P}/ghc"
add-c_nonshared-to-ghci-libs

if [[ ! -f "${S}/VERSION" ]]; then
echo "${GHC_PV}" > "${S}/VERSION" \
Expand Down
1 change: 1 addition & 0 deletions dev-lang/ghc/ghc-7.8.4.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ src_prepare() {
epatch "${FILESDIR}"/${PN}-7.8.3-linker-warn.patch
epatch "${FILESDIR}"/${PN}-7.8.3-pic-sparc.patch
epatch "${FILESDIR}"/${PN}-7.8.3-ppc32-fPIC.patch
epatch "${FILESDIR}"/${PN}-7.8.4-gold.patch

if use prefix; then
# Make configure find docbook-xsl-stylesheets from Prefix
Expand Down

0 comments on commit 3b14185

Please sign in to comment.