[FFmpeg-devel] [PATCH v4] libavcodec: Set hidden visibility on global symbols accessed from AArch64 assembly
Martin Storsjö
martin at martin.st
Fri Sep 2 16:25:43 EEST 2022
On Sat, 27 Aug 2022, Martin Storsjö wrote:
> The AArch64 assembly accesses those symbols directly, without
> indirection via e.g. the GOT on ELF. In order for this not to
> require text relocations, those symbols need to be resolved fully
> at link time, i.e. those symbols can't be interposable.
>
> Normally, so far, this is achieved when linking shared libraries
> in two ways; we have a version script (libavcodec/libavcodec.v) which
> marks all symbols that don't start with av* as local. Additionally,
> we try to add -Wl,-Bsymbolic to the linker options if supported,
> making sure that such symbol references are resolved fully at link
> time, instead of making them interposable.
>
> When the libavcodec static library is linked into another shared
> library, there's no guarantee that it uses similar options (even though
> that would be favourable), which would end up requiring text relocations
> in the AArch64 assembly.
>
> Explicitly mark the symbols that are accessed from AArch64 assembly
> as hidden, so that they are resolved fully at link time even without
> the version script and -Wl,-Bsymbolic.
>
> Signed-off-by: Martin Storsjö <martin at martin.st>
> ---
> v4: Moved the attribute definition to a new, standalone header (which
> only depends on libavutil/attributes.h).
> ---
> libavcodec/aacsbrdata.h | 3 ++-
> libavcodec/fft.h | 3 ++-
> libavcodec/vp9dsp.h | 3 ++-
> libavutil/attributes_internal.h | 30 ++++++++++++++++++++++++++++++
> 4 files changed, 36 insertions(+), 3 deletions(-)
> create mode 100644 libavutil/attributes_internal.h
OK'd by Andreas on irc, will push later today.
// Martin
More information about the ffmpeg-devel
mailing list