Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v2] libavcodec: Set hidden visibility on global symbols accessed from AArch64 assembly
Date: Thu, 14 Jul 2022 22:52:32 +0300 (EEST)
Message-ID: <c5c458c4-635c-ce87-f82c-1b74fc595e41@martin.st> (raw)
In-Reply-To: <20220714145141.GB2088045@pb2>

On Thu, 14 Jul 2022, Michael Niedermayer wrote:

> On Thu, Jul 14, 2022 at 12:14:38AM +0300, 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@martin.st>
>> ---
>> Moved the attribute to libavutil/internal.h, renamed to a different
>> namespace (not av_ prefixed), moved the attribute on ff_vp9_subpel_filters
>> to the header, as suggested.
>> ---
>>  libavcodec/aacsbrdata.h | 2 +-
>>  libavcodec/fft.h        | 2 +-
>>  libavcodec/vp9dsp.h     | 2 +-
>>  libavutil/internal.h    | 6 ++++++
>>  4 files changed, 9 insertions(+), 3 deletions(-)
>
> This seems to break build on linux x86-64, i guess iam missing something
>
> MAN	doc/ffprobe-all.1
> In file included from libavcodec/x86/vp9dsp_init_16bpp.c:26:0:
> ./libavcodec/vp9dsp.h:123:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_vp9_subpel_filters’
> extern const int16_t attribute_visibility_hidden ff_vp9_subpel_filters[3][16][8];
>                                                  ^~~~~~~~~~~~~~~~~~~~~
> ffbuild/common.mak:81: recipe for target 'libavcodec/x86/vp9dsp_init_16bpp.o' failed
> make: *** [libavcodec/x86/vp9dsp_init_16bpp.o] Error 1
> make: *** Waiting for unfinished jobs....
> In file included from libavcodec/x86/vp9dsp_init_16bpp_template.c:26:0,
>                 from libavcodec/x86/vp9dsp_init_12bpp.c:25:
> ./libavcodec/vp9dsp.h:123:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_vp9_subpel_filters’
> extern const int16_t attribute_visibility_hidden ff_vp9_subpel_filters[3][16][8];
>                                                  ^~~~~~~~~~~~~~~~~~~~~
> In file included from libavcodec/x86/vp9dsp_init_16bpp_template.c:26:0,
>                 from libavcodec/x86/vp9dsp_init_10bpp.c:25:
> ./libavcodec/vp9dsp.h:123:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_vp9_subpel_filters’
> extern const int16_t attribute_visibility_hidden ff_vp9_subpel_filters[3][16][8];
>                                                  ^~~~~~~~~~~~~~~~~~~~~
> ffbuild/common.mak:81: recipe for target 'libavcodec/x86/vp9dsp_init_12bpp.o' failed
> make: *** [libavcodec/x86/vp9dsp_init_12bpp.o] Error 1
> ffbuild/common.mak:81: recipe for target 'libavcodec/x86/vp9dsp_init_10bpp.o' failed
> make: *** [libavcodec/x86/vp9dsp_init_10bpp.o] Error 1
> In file included from libavcodec/x86/vp9dsp_init.c:26:0:
> ./libavcodec/vp9dsp.h:123:50: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ff_vp9_subpel_filters’
> extern const int16_t attribute_visibility_hidden ff_vp9_subpel_filters[3][16][8];
>                                                  ^~~~~~~~~~~~~~~~~~~~~
> ffbuild/common.mak:81: recipe for target 'libavcodec/x86/vp9dsp_init.o' failed
> make: *** [libavcodec/x86/vp9dsp_init.o] Error 1

Thanks, it seems I need to add an explicit include of libavutil/internal.h 
in vp9dsp.h. Fixing.

// Martin
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2022-07-14 19:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 21:14 Martin Storsjö
2022-07-14 14:51 ` Michael Niedermayer
2022-07-14 19:52   ` Martin Storsjö [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c5c458c4-635c-ce87-f82c-1b74fc595e41@martin.st \
    --to=martin@martin.st \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git