[Bug 257124] multimedia/ffmpeg: Fails to link: ld: error: inline assembly requires more registers than available at line [on i386 with LTO option]

From: <bugzilla-noreply_at_freebsd.org>
Date: Tue, 13 Jul 2021 18:52:53 +0000

--- Comment #13 from Dimitry Andric <dim_at_FreeBSD.org> ---
(In reply to Mikhail Teterin from comment #12)
> Why would a problem with inline assembly be manifested only in case of LTO?

LTO will enable global optimizations, such as inlining functions from different
translation units. If functions get inlined, the number of available register
slots can change, since there are now also other variables in the blocks of
code being compiled. This can lead to a shortage of registers. In case of plain
C or C++ code, the compiler knows how to rearrange some variables so they go to
the stack instead, but for inline assembly there is no such choice, since the
author specifies (or at least, can specify) precisely the registers to use. In
some situations this can leave the compiler with no registers 'left' to put
other variables in, and typically it will error out then. This is indeed a
cop-out strategy, and happens often with inline assembly.

In the past, FFmpeg had many more cases of this, and also could make gcc keel
over unless you used very specific optimization flags. Which is probably why
FFmpeg started rewriting most of their assembly functions in nasm.

> If it is not, then the bug is with ffmpeg -- something FreeBSD port-maintainers may be able to patch and/or raise with the upstream authors.

The problem here is pinpointing the particular function that is causing the
error. This is at the moment not possible, since the LTO stage doesn't seem to
keep enough information around to tell you which source file is involved. Also,
since the line numbers it mentions are very large, I guess it is reporting
something about an intermediate form (.ll or .bc file). So to be able to find
the culprit(s), you'd have to somehow get to that intermediate form.

You are receiving this mail because:
You are the assignee for the bug.
Received on Tue Jul 13 2021 - 18:52:53 UTC

Original text of this message