[FFmpeg-devel] [PATCH] avutil/mem: Mark DECLARE_ASM_ALIGNED as visibility("hidden") for __GNUC__

Carl Eugen Hoyos ceffmpeg at gmail.com
Thu Feb 21 02:18:43 EET 2019

2019-02-20 10:13 GMT+01:00, Fāng-ruì Sòng <maskray-at-google.com at ffmpeg.org>:
> Inline asm code assumes these DECLARE_ASM_ALIGNED declared global
> constants are non-preemptive, e.g.
> libavcodec/x86/cabac.h
>         "lea    "MANGLE(ff_h264_cabac_tables)", %0      \n\t"
> On ELF platforms, if -Wl,-Bsymbolic
> -Wl,--version-script,libavcodec/libavcodec.ver are removed from the
> linker command line, the symbol will be considered preemptive and fail

Why is it a good idea to remove them from the linker command line?

> to link to a DSO:
>     ld.lld: error: relocation R_X86_64_PC32 cannot be used against
> symbol ff_h264_cabac_tables; recompile with -fPIC
> It is better to express the intention explicitly and mark such global
> constants hidden (non-preemptive). It also improves portability as no
> linker magic is required.
> DECLARE_ASM_CONST uses the "static" specifier to indicate internal
> linkage. The visibility annotation is unnecessary.
> Also remove __clang__ as clang pretends to be gcc 4.2 and defines __GNUC__

The word "also" indicates here that this should be an
independent patch.

Carl Eugen

More information about the ffmpeg-devel mailing list