summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoonas Niilola <juippis@gentoo.org>2023-01-29 10:48:30 +0200
committerJoonas Niilola <juippis@gentoo.org>2023-01-29 10:50:21 +0200
commitc38056ecf68cd7c730d41fcf131829175a7793ab (patch)
tree3e794219330ccccc5f8b8087d0a57446f12f3b31 /www-client
parentwww-client/seamonkey: add a missing dep xorg-proto on 2.53.15 (diff)
downloadgentoo-c38056ecf68cd7c730d41fcf131829175a7793ab.tar.gz
gentoo-c38056ecf68cd7c730d41fcf131829175a7793ab.tar.bz2
gentoo-c38056ecf68cd7c730d41fcf131829175a7793ab.zip
www-client/firefox: support mold linker in 109.0
Closes: https://github.com/gentoo/gentoo/pull/28366 Signed-off-by: Joonas Niilola <juippis@gentoo.org>
Diffstat (limited to 'www-client')
-rw-r--r--www-client/firefox/firefox-109.0.ebuild74
1 files changed, 64 insertions, 10 deletions
diff --git a/www-client/firefox/firefox-109.0.ebuild b/www-client/firefox/firefox-109.0.ebuild
index c2e92bead6a2..e6d4ce7a40de 100644
--- a/www-client/firefox/firefox-109.0.ebuild
+++ b/www-client/firefox/firefox-109.0.ebuild
@@ -88,7 +88,10 @@ BDEPEND="${PYTHON_DEPS}
sys-devel/clang:15
sys-devel/llvm:15
clang? (
- sys-devel/lld:15
+ || (
+ sys-devel/lld:15
+ sys-devel/mold
+ )
virtual/rust:0/llvm-15
pgo? ( =sys-libs/compiler-rt-sanitizers-15*[profile] )
)
@@ -97,7 +100,10 @@ BDEPEND="${PYTHON_DEPS}
sys-devel/clang:14
sys-devel/llvm:14
clang? (
- sys-devel/lld:14
+ || (
+ sys-devel/lld:14
+ sys-devel/mold
+ )
virtual/rust:0/llvm-14
pgo? ( =sys-libs/compiler-rt-sanitizers-14*[profile] )
)
@@ -227,7 +233,7 @@ llvm_check_deps() {
return 1
fi
- if use clang ; then
+ if use clang && tc-ld-is-lld ; then
if ! has_version -b "sys-devel/lld:${LLVM_SLOT}" ; then
einfo "sys-devel/lld:${LLVM_SLOT} is missing! Cannot use LLVM slot ${LLVM_SLOT} ..." >&2
return 1
@@ -427,6 +433,40 @@ mozconfig_use_with() {
mozconfig_add_options_ac "$(use ${1} && echo +${1} || echo -${1})" "${flag}"
}
+# This is a straight copypaste from toolchain-funcs.eclass's 'tc-ld-is-lld', and is temporarily
+# placed here until toolchain-funcs.eclass gets an official support for mold linker.
+# Please see:
+# https://github.com/gentoo/gentoo/pull/28366 ||
+# https://github.com/gentoo/gentoo/pull/28355
+tc-ld-is-mold() {
+ local out
+
+ # Ensure ld output is in English.
+ local -x LC_ALL=C
+
+ # First check the linker directly.
+ out=$($(tc-getLD "$@") --version 2>&1)
+ if [[ ${out} == *"mold"* ]] ; then
+ return 0
+ fi
+
+ # Then see if they're selecting mold via compiler flags.
+ # Note: We're assuming they're using LDFLAGS to hold the
+ # options and not CFLAGS/CXXFLAGS.
+ local base="${T}/test-tc-linker"
+ cat <<-EOF > "${base}.c"
+ int main() { return 0; }
+ EOF
+ out=$($(tc-getCC "$@") ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -Wl,--version "${base}.c" -o "${base}" 2>&1)
+ rm -f "${base}"*
+ if [[ ${out} == *"mold"* ]] ; then
+ return 0
+ fi
+
+ # No mold here!
+ return 1
+}
+
virtwl() {
debug-print-function ${FUNCNAME} "$@"
@@ -486,7 +526,7 @@ pkg_setup() {
llvm_pkg_setup
- if use clang && use lto ; then
+ if use clang && use lto && tc-ld-is-lld ; then
local version_lld=$(ld.lld --version 2>/dev/null | awk '{ print $2 }')
[[ -n ${version_lld} ]] && version_lld=$(ver_cut 1 "${version_lld}")
[[ -z ${version_lld} ]] && die "Failed to read ld.lld version!"
@@ -856,13 +896,18 @@ src_configure() {
if use lto ; then
if use clang ; then
- # Upstream only supports lld when using clang
- mozconfig_add_options_ac "forcing ld=lld due to USE=clang and USE=lto" --enable-linker=lld
+ # Upstream only supports lld or mold when using clang.
+ if tc-ld-is-mold ; then
+ mozconfig_add_options_ac "using ld=mold due to system selection" --enable-linker=mold
+ else
+ mozconfig_add_options_ac "forcing ld=lld due to USE=clang and USE=lto" --enable-linker=lld
+ fi
mozconfig_add_options_ac '+lto' --enable-lto=cross
else
- # ThinLTO is currently broken, see bmo#1644409
+ # ThinLTO is currently broken, see bmo#1644409.
+ # mold does not support gcc+lto combination.
mozconfig_add_options_ac '+lto' --enable-lto=full
mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd
fi
@@ -878,10 +923,19 @@ src_configure() {
else
# Avoid auto-magic on linker
if use clang ; then
- # This is upstream's default
- mozconfig_add_options_ac "forcing ld=lld due to USE=clang" --enable-linker=lld
+ # lld is upstream's default
+ if tc-ld-is-mold ; then
+ mozconfig_add_options_ac "using ld=mold due to system selection" --enable-linker=mold
+ else
+ mozconfig_add_options_ac "forcing ld=lld due to USE=clang" --enable-linker=lld
+ fi
+
else
- mozconfig_add_options_ac "linker is set to bfd" --enable-linker=bfd
+ if tc-ld-is-mold ; then
+ mozconfig_add_options_ac "using ld=mold due to system selection" --enable-linker=mold
+ else
+ mozconfig_add_options_ac "linker is set to bfd due to USE=-clang" --enable-linker=bfd
+ fi
fi
fi