From 3f6e982fcbb517768ed0b6c4ab8ee26ab14e22d2 Mon Sep 17 00:00:00 2001 From: "Gregory M. Turner" Date: Fri, 25 Sep 2015 22:30:06 -0700 Subject: [PATCH] dev-lang/fpc: never link with gcc's ld.gold Drops the premerge barf-out and replaces with a working solution. Only takes action when the portage environment is configured such that tc-getLD returns a GNU gold linker. Mostly I just follow the recipe in toolchain-functions.eclass's tc-ld-disable-gold; however, we gain nothing from that in fpc because tc-ld-disable-gold does not modify the PATH and hence we would need to duplicate all of the work it did privately anyhow. It might be nice to fix this in tc-ld-disable-gold. I know packages that hard code "ld" invocations hardly deserve a gold star for flexibility, but that doesn't mean gentoo shouldn't support them (case-in-commit imo). Fixes: #475210 Signed-off-by: Gregory M. Turner --- dev-lang/fpc/fpc-2.6.4.ebuild | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/dev-lang/fpc/fpc-2.6.4.ebuild b/dev-lang/fpc/fpc-2.6.4.ebuild index eff2e5a..a1b7661 100644 --- a/dev-lang/fpc/fpc-2.6.4.ebuild +++ b/dev-lang/fpc/fpc-2.6.4.ebuild @@ -30,17 +30,6 @@ RESTRICT="strip" #269221 S=${WORKDIR}/fpcbuild-${PV}/fpcsrc -pkg_pretend() { - if [[ ${MERGE_TYPE} != binary ]]; then - # Bug 475210 - if $(tc-getLD) --version | grep -q "GNU gold"; then - eerror "fpc does not function correctly when built with the gold linker." - eerror "Please select the bfd linker with binutils-config." - die "GNU gold detected" - fi - fi -} - src_unpack() { case ${ARCH} in amd64) FPC_ARCH="x86_64" PV_BIN=${PV} ;; @@ -84,6 +73,18 @@ set_pp() { } src_compile() { + if tc-ld-is-gold; then + local ld=$(tc-getLD "$@") + local bfd_ld="${ld%% *}.bfd" + local path_ld=$(which "${bfd_ld}" 2>/dev/null) + [[ -e ${path_ld} ]] || die 'No bfd?' + export LD=${bfd_ld} + local d="${T}/bfd-linker" + mkdir -p "${d}" + ln -sf "${path_ld}" "${d}"/ld + export PATH="${d}:${PATH}" + fi + local pp # Using the bootstrap compiler. -- 2.5.3