Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] [PATCH 2/2] libavcodec: Set hidden visibility on global symbols accessed from AArch64 assembly
Date: Mon, 11 Jul 2022 12:58:32 +0200
Message-ID: <DB6PR0101MB2214EB8AD4CC1743B0E90BAB8F879@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com> (raw)
In-Reply-To: <20220711091850.4158449-2-martin@martin.st>

Martin Storsjö:
> 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>
> ---
>  libavcodec/aacsbrdata.h | 2 +-
>  libavcodec/fft.h        | 2 +-
>  libavcodec/vp9dsp.c     | 2 +-
>  3 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/aacsbrdata.h b/libavcodec/aacsbrdata.h
> index 7a11594c9b..aa382c4b52 100644
> --- a/libavcodec/aacsbrdata.h
> +++ b/libavcodec/aacsbrdata.h
> @@ -268,7 +268,7 @@ static const int8_t sbr_offset[6][16] = {
>  };
>  
>  /* First eight entries repeated at end to simplify SIMD implementations. */
> -const DECLARE_ALIGNED(16, INTFLOAT, AAC_RENAME(ff_sbr_noise_table))[][2] = {
> +const av_visibility_hidden DECLARE_ALIGNED(16, INTFLOAT, AAC_RENAME(ff_sbr_noise_table))[][2] = {
>  {Q31(-0.99948153278296f), Q31(-0.59483417516607f)}, {Q31( 0.97113454393991f), Q31(-0.67528515225647f)},
>  {Q31( 0.14130051758487f), Q31(-0.95090983575689f)}, {Q31(-0.47005496701697f), Q31(-0.37340549728647f)},
>  {Q31( 0.80705063769351f), Q31( 0.29653668284408f)}, {Q31(-0.38981478896926f), Q31( 0.89572605717087f)},
> diff --git a/libavcodec/fft.h b/libavcodec/fft.h
> index 706c9d07f5..c2241fbc7c 100644
> --- a/libavcodec/fft.h
> +++ b/libavcodec/fft.h
> @@ -114,7 +114,7 @@ void ff_init_ff_cos_tabs(int index);
>  #endif
>  
>  #define COSTABLE(size) \
> -    COSTABLE_CONST DECLARE_ALIGNED(32, FFTSample, FFT_NAME(ff_cos_##size))[size/2]
> +    COSTABLE_CONST av_visibility_hidden DECLARE_ALIGNED(32, FFTSample, FFT_NAME(ff_cos_##size))[size/2]
>  
>  extern COSTABLE(16);
>  extern COSTABLE(32);
> diff --git a/libavcodec/vp9dsp.c b/libavcodec/vp9dsp.c
> index d8ddf74d4f..1be942d78b 100644
> --- a/libavcodec/vp9dsp.c
> +++ b/libavcodec/vp9dsp.c
> @@ -29,7 +29,7 @@
>  
>  #include "vp9dsp.h"
>  
> -const DECLARE_ALIGNED(16, int16_t, ff_vp9_subpel_filters)[3][16][8] = {
> +const av_visibility_hidden DECLARE_ALIGNED(16, int16_t, ff_vp9_subpel_filters)[3][16][8] = {

Shouldn't you set this in vp9dsp.h, so that all users of it can benefit
from knowing that this symbol is always in the same DSO?

>      [FILTER_8TAP_REGULAR] = {
>          {  0,  0,   0, 128,   0,   0,  0,  0 },
>          {  0,  1,  -5, 126,   8,  -3,  1,  0 },

_______________________________________________
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-11 10:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11  9:18 [FFmpeg-devel] [PATCH 1/2] libavutil: Add av_visibility_hidden for setting hidden symbol visibility Martin Storsjö
2022-07-11  9:18 ` [FFmpeg-devel] [PATCH 2/2] libavcodec: Set hidden visibility on global symbols accessed from AArch64 assembly Martin Storsjö
2022-07-11 10:58   ` Andreas Rheinhardt [this message]
2022-07-11 10:20 ` [FFmpeg-devel] [PATCH 1/2] libavutil: Add av_visibility_hidden for setting hidden symbol visibility Andreas Rheinhardt
2022-07-11 10:40   ` Martin Storsjö
2022-07-11 10:57     ` Andreas Rheinhardt
2022-07-13 11:27     ` Anton Khirnov
2022-07-11 12:12 ` Henrik Gramner
2022-07-11 12:32   ` Triang3l
2022-07-11 14:26   ` Andreas Rheinhardt
2022-07-11 16:51     ` Timo Rothenpieler
2022-07-11 16:57       ` Andreas Rheinhardt
2022-07-11 21:41   ` Martin Storsjö
2022-07-11 21:42     ` Martin Storsjö

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=DB6PR0101MB2214EB8AD4CC1743B0E90BAB8F879@DB6PR0101MB2214.eurprd01.prod.exchangelabs.com \
    --to=andreas.rheinhardt@outlook.com \
    --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