Created attachment 523834 [details, diff] mplayer-1.3.0-fix-lto-linking.patch With LTO, building mplayer fails during the final link. Here's the relevant part of the build log: x86_64-pc-linux-gnu-gcc -o mplayer [...many objects, libs, and options...] [...unrelated warnings...] /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/portage/media-video/mplayer-1.3.0-r4/temp/cc2me1CP.ltrans18.ltrans.o: warning: relocation against `sse_int32_map_factor' in readonly section `.text' /tmp/portage/media-video/mplayer-1.3.0-r4/temp/cc2me1CP.ltrans18.ltrans.o: In function `render_frame_yuv420p_sse4': <artificial>:(.text+0xb1b): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xb24): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xb2d): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xb36): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xb3e): undefined reference to `sse_int32_80h' <artificial>:(.text+0xb46): undefined reference to `sse_int32_80h' <artificial>:(.text+0xb4e): undefined reference to `sse_int32_80h' <artificial>:(.text+0xb56): undefined reference to `sse_int32_80h' <artificial>:(.text+0xc93): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xc9c): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xca5): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xcae): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0xcb6): undefined reference to `sse_int32_80h' <artificial>:(.text+0xcbe): undefined reference to `sse_int32_80h' <artificial>:(.text+0xcc6): undefined reference to `sse_int32_80h' <artificial>:(.text+0xcce): undefined reference to `sse_int32_80h' /tmp/portage/media-video/mplayer-1.3.0-r4/temp/cc2me1CP.ltrans18.ltrans.o: In function `render_frame_yuv422_sse4': <artificial>:(.text+0x1143): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0x114c): undefined reference to `sse_int32_map_factor' <artificial>:(.text+0x1154): undefined reference to `sse_int32_80h' <artificial>:(.text+0x115c): undefined reference to `sse_int32_80h' /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: warning: creating a DT_TEXTREL in a shared object. collect2: error: ld returned 1 exit status make: *** [Makefile:747: mplayer] Error 1 * ERROR: media-video/mplayer-1.3.0-r4::gentoo failed (compile phase): * emake failed This is due to some inline assembler which uses direct symbol references. Because gcc doesn't parse asm statements, it doesn't know these variables are referenced from the code, and when partitioning it may omit them from the units where they're needed. The attached patch disables direct references and adds named constraints where missing. That fixes the build for me.
Bug still present in 1.4-r1, but the patch for version 1.3.0 still works with the newer release :) Iade Gesso, PhD
Can you submit this upstream please? Thanks.
*** Bug 861140 has been marked as a duplicate of this bug. ***
Yes, sure, here it is: https://trac.mplayerhq.hu/ticket/2408
(In reply to Jocelyn Mayer from comment #4) > Yes, sure, here it is: > https://trac.mplayerhq.hu/ticket/2408 Thank you!
while waiting for this patch to be validated upstream, as you said you feel it too invasive in #861140, there are several possibility to avoid this issue. The proposal I got, from what I think the worse to the best: » Put a restriction in the ebuild to block USE="libass" and LTO together (inside pkg_setup ?) » Globally disable sse4 support when havind USE="libass" and LTO together adding --disable--sse4 in myconf inside src_configure » When LTO is requested, lightly patch libmpcodecs/vf_ass.c to disable use of sse4 there: --- MPlayer-1.4/libmpcodecs/vf_ass.c 2022-12-28 00:44:19.772746286 +0100 +++ MPlayer-1.4/libmpcodecs/vf_ass.c 2022-12-28 00:44:45.937417351 +0100 @@ -20,8 +20,6 @@ */ #include "config.h" +#undef HAVE_SSE4_INLINE +#define HAVE_SSE4_INLINE 0 #include <stdio.h> #include <stdlib.h> All the 3 should make the trick, the last one seems the least problematic for global optimization.
This is still present as of media-video/mplayer-1.5_p20230618
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f58be0378c335bf9725621734555ca1cf87983f7 commit f58be0378c335bf9725621734555ca1cf87983f7 Author: Eli Schwartz <eschwartz93@gmail.com> AuthorDate: 2024-03-11 20:54:14 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-03-11 21:31:42 +0000 media-video/mplayer: mark as LTO-unsafe It is specifically a problem when used in combination with libass and sse4 support, so limit our filtering. Closes: https://bugs.gentoo.org/461634 Closes: https://bugs.gentoo.org/650458 Signed-off-by: Eli Schwartz <eschwartz93@gmail.com> Signed-off-by: Sam James <sam@gentoo.org> media-video/mplayer/mplayer-1.5_p20230215.ebuild | 5 +++++ media-video/mplayer/mplayer-1.5_p20230618.ebuild | 5 +++++ media-video/mplayer/mplayer-1.5_p20231206.ebuild | 5 +++++ media-video/mplayer/mplayer-9999.ebuild | 5 +++++ 4 files changed, 20 insertions(+)