diff --git a/sys-fs/fuse/fuse-2.9.7.ebuild b/sys-fs/fuse/fuse-2.9.7.ebuild index d440951..43c568c 100644 --- a/sys-fs/fuse/fuse-2.9.7.ebuild +++ b/sys-fs/fuse/fuse-2.9.7.ebuild @@ -39,6 +39,7 @@ src_prepare() { } src_configure() { + tc-ld-disable-gold-for-libtool econf \ INIT_D_PATH="${EPREFIX}/etc/init.d" \ MOUNT_FUSE_PATH="${EPREFIX}/sbin" \ @@ -82,3 +83,45 @@ src_install() { #user_allow_other EOF } + +# @FUNCTION: tc-ld-disable-gold-for-libtool +# @USAGE: [toolchain prefix] +# @DESCRIPTION: +# If the gold linker is currently selected, configure the compilation +# settings so that we use the older bfd linker instead. +# Special version that prepends '-Xlinker' for libtool +tc-ld-disable-gold-for-libtool() { + if ! tc-ld-is-gold "$@" ; then + # They aren't using gold, so nothing to do! + return + fi + + ewarn "Forcing usage of the BFD linker instead of GOLD" + + # Set up LD to point directly to bfd if it's available. + # We need to extract the first word in case there are flags appended + # to its value (like multilib). #545218 + local ld=$(tc-getLD "$@") + local bfd_ld="${ld%% *}.bfd" + local path_ld=$(which "${bfd_ld}" 2>/dev/null) + [[ -e ${path_ld} ]] && export LD=${bfd_ld} + + # Set up LDFLAGS to select gold based on the gcc version. + local major=$(gcc-major-version "$@") + local minor=$(gcc-minor-version "$@") + if [[ ${major} -lt 4 ]] || [[ ${major} -eq 4 && ${minor} -lt 8 ]] ; then + # <=gcc-4.7 requires some coercion. Only works if bfd exists. + if [[ -e ${path_ld} ]] ; then + local d="${T}/bfd-linker" + mkdir -p "${d}" + ln -sf "${path_ld}" "${d}"/ld + export LDFLAGS="${LDFLAGS} -Xlinker -B${d}" + else + die "unable to locate a BFD linker to bypass gold" + fi + else + # gcc-4.8+ supports -fuse-ld directly. + export LDFLAGS="${LDFLAGS} -Xlinker -fuse-ld=bfd" + fi +} +