Opened 23 months ago

Last modified 22 months ago

#2408 new defect

mplayer / mencoder fail to link when compiling with -flto

Reported by: Mayer Jocelyn Owned by: beastd
Priority: normal Component: vf
Version: 1.4 Severity: blocker
Keywords: Cc:
Blocked By: Blocking:
Reproduced by developer: no Analyzed by developer: no

Description

Summary of the bug:
How to reproduce:
» Make sure '-flto' is set in build flags
» try to build mplayer with --enable-libass
» mplayer & mencoder link would fail with multiple undefined reference to sse_int32_map_factor' and sse_int32_80h' in libmpcodecs/vf_ass.c

This has been reproduced with (old) 1.3.0 version and newer 1.4 version.
As far as I can see, no fix have been committed for this in trunk.

A workaround is available in gentoo linux bugtracking system:
https://bugs.gentoo.org/650458 with a patch available, which follow for easier potential fix.

This patch applied make the link succesful.

Attachments (1)

mplayer-1.4-r1-vf_ass-asm_fix.patch (1.2 KB ) - added by Mayer Jocelyn 23 months ago.
Patch submitted to gentoo bugtracking system in order to fix this link issue

Download all attachments as: .zip

Change History (4)

by Mayer Jocelyn, 23 months ago

Patch submitted to gentoo bugtracking system in order to fix this link issue

comment:1 by reimar, 22 months ago

The analysis of the issue in the gentoo bug is at least incomplete. The symbols are marked attribute((used)) so gcc has been explicitly told it has to preserve them and very much knows it has to keep them.

comment:2 by reimar, 22 months ago

I would consider this a compiler bug: It has been told the symbol is needed yet it does not keep it available for all code in the relevant compilation unit (as a minimum).
This is how FFmpeg works around it:
if enabled lto; then

test "$cc_type" != "$ld_type" && die "LTO requires same compiler and linker"
check_cflags -flto
check_ldflags -flto $cpuflags
disable inline_asm_direct_symbol_refs

fi

We don't support disabling direct symbol refs for inline asm yet.
Also vf_ass is not the only file ending up with link issues by far (vf_fspp does as well), but it might be the only one enabled when you link against system FFmpeg libraries.

comment:3 by reimar, 22 months ago

-flto-partition=none works at the cost of longer compile time.

Note: See TracTickets for help on using tickets.