In https://bugs.gentoo.org/566282 , the ebuilds for media-video/ffmpeg were amended to support LTO. Unfortunately, they do not respect the -fno-lto flag, particularly if your CFLAGS/CXXFLAGS contain "-flto -fno-lto" -- it will build with "--enable-lto" regardless.
A comment on that bug report suggested a fix: https://bugs.gentoo.org/566282#c6
I have tested this fix on my own overlay and it appears to work as intended. I can submit patches to fix the ebuilds using this if desired.
Thank you for your time,
PR created: https://github.com/gentoo/gentoo/pull/5766