From: "Martin Storsjö" <martin@martin.st>
To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH] avcodec/aarch64: Access externs via GOT with PIC
Date: Mon, 11 Jul 2022 01:28:44 +0300 (EEST)
Message-ID: <81409a7e-e810-c098-25ee-9f10932aa84b@martin.st> (raw)
In-Reply-To: <7542af15-2e7-eba5-8a97-b8eb8ce8c8d9@martin.st>
On Mon, 11 Jul 2022, Martin Storsjö wrote:
> Hi,
>
> Thanks for your patch! While the patch probably is worthwhile to pursue,
> ffmpeg does work on Android 6 and newer (with the aarch64 assembly), so
> there's some gaps/misses in the reasoning in the patch description.
>
> On Sun, 10 Jul 2022, Triang3l wrote:
>
>> To support PIC, all AArch64 assembly code in FFmpeg uses the `movrel` macro
>> to obtain addresses of labels, such as lookup table constants, in a way
>> that with CONFIG_PIC being 1, PC-relative addresses of labels are computed
>> via the `adrp` instruction.
>
>> This approach, however, is suitable only for labels defined in the same
>> object file. For `adrp` to work directly between object files, the linker
>> has to perform a text relocation.
>
> No, it doesn't. It's fully possible to build such libraries without text
> relocations currently.
>
> My memory of the situation was that we're linking our shared libraries with
> -Wl,-Bsymbolic, which means that those symbol references are bound at link
> time, so the offset from adrp to the target symbol is fixed at link time, and
> no text relocation is needed.
>
> However I did try to link such shared libraries, removing the -Wl,-Bsymbolic
> argument, and it still succeeds. So I'm a bit unsure what really makes it
> work for me when it isn't working for you.
Andreas Rheinhardt kindly reminded me that when linking libavcodec.so, we
add -Wl,--version-script,libavcodec/libavcodec.ver, which makes e.g.
ff_cos_32 a non-exported symbol, which means that it can't be interposed,
and thus the relocation can be fixed at link time.
If I remove that argument, I can reproduce the linker errors, and adding
-Wl,-Bsymbolic fixes it.
I wonder if we could mark these symbols as ELF hidden, so that they
wouldn't need to be interposable at all, even when you link the static
library into a separate shared library?
// 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".
next prev parent reply other threads:[~2022-07-10 22:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-10 16:08 Triang3l
2022-07-10 22:17 ` Martin Storsjö
2022-07-10 22:28 ` Martin Storsjö [this message]
2022-07-11 0:25 ` Triang3l
2022-07-11 9:00 ` Martin Storsjö
2022-07-11 0:31 Triang3l
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=81409a7e-e810-c098-25ee-9f10932aa84b@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