media-video/ffmpeg: disable lto if clang+mold for now

gcc+any or clang+lld/bfd are fine, per bug #947697 comment #7 where
rust faces a similar issue, seems to be specific to clang+mold.

Do not know what is really to blame here (clang, mold, or ffmpeg's
build system for not passing -flto during linking), but would rather
do the simplest solution until resolved in whichever. A alternative
would be to avoid stripping LDFLAGS if mold but I'd rather to leave
lto handling entirely to ffmpeg to be as intended.

Feel free to report if this been fixed somewhere (odds are I won't
test this myself often), then will drop this after fixed toolchain
was at least stabilized or added a ffmpeg backport. Put the logic on
its own line for easier removal even if it does the get-flag bit for
nothing.

Haven't tested if older ffmpeg versions are affected too, but would
rather keep this in sync so putting it in every versions (except
ffmpeg-4 which hard disables lto anyway). Did test ffmpeg-8 and it
did fail with it.

Closes: https://bugs.gentoo.org/963835
Signed-off-by: Ionen Wolkens <ionen@gentoo.org>
This commit is contained in:
Ionen Wolkens
2025-10-06 19:37:21 -04:00
parent a54626df59
commit 188057c10c
5 changed files with 10 additions and 0 deletions

View File

@@ -387,6 +387,8 @@ src_prepare() {
if tc-is-lto; then
: "$(get-flag -flto)" # get -flto=<val> (e.g. =thin)
FFMPEG_ENABLE_LTO=--enable-lto${_#-flto}
tc-ld-is-mold && tc-is-clang && FFMPEG_ENABLE_LTO= #963835
fi
filter-lto

View File

@@ -398,6 +398,8 @@ src_prepare() {
if tc-is-lto; then
: "$(get-flag -flto)" # get -flto=<val> (e.g. =thin)
FFMPEG_ENABLE_LTO=--enable-lto${_#-flto}
tc-ld-is-mold && tc-is-clang && FFMPEG_ENABLE_LTO= #963835
fi
filter-lto
}

View File

@@ -398,6 +398,8 @@ src_prepare() {
if tc-is-lto; then
: "$(get-flag -flto)" # get -flto=<val> (e.g. =thin)
FFMPEG_ENABLE_LTO=--enable-lto${_#-flto}
tc-ld-is-mold && tc-is-clang && FFMPEG_ENABLE_LTO= #963835
fi
filter-lto
}

View File

@@ -393,6 +393,8 @@ src_prepare() {
if tc-is-lto; then
: "$(get-flag -flto)" # get -flto=<val> (e.g. =thin)
FFMPEG_ENABLE_LTO=--enable-lto${_#-flto}
tc-ld-is-mold && tc-is-clang && FFMPEG_ENABLE_LTO= #963835
fi
filter-lto
}

View File

@@ -392,6 +392,8 @@ src_prepare() {
if tc-is-lto; then
: "$(get-flag -flto)" # get -flto=<val> (e.g. =thin)
FFMPEG_ENABLE_LTO=--enable-lto${_#-flto}
tc-ld-is-mold && tc-is-clang && FFMPEG_ENABLE_LTO= #963835
fi
filter-lto
}