From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id B110B433C8 for ; Sun, 10 Jul 2022 22:28:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8D68668B682; Mon, 11 Jul 2022 01:28:51 +0300 (EEST) Received: from mail8.parnet.fi (mail8.parnet.fi [77.234.108.134]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3D9AB68B595 for ; Mon, 11 Jul 2022 01:28:45 +0300 (EEST) Received: from mail9.parnet.fi (mail9.parnet.fi [77.234.108.21]) by mail8.parnet.fi with ESMTP id 26AMSiUg013827-26AMSiUh013827 for ; Mon, 11 Jul 2022 01:28:44 +0300 Received: from foo.martin.st (host-97-187.parnet.fi [77.234.97.187]) by mail9.parnet.fi (Postfix) with ESMTPS id 85498A150B for ; Mon, 11 Jul 2022 01:28:44 +0300 (EEST) Date: Mon, 11 Jul 2022 01:28:44 +0300 (EEST) From: =?ISO-8859-15?Q?Martin_Storsj=F6?= To: FFmpeg development discussions and patches In-Reply-To: <7542af15-2e7-eba5-8a97-b8eb8ce8c8d9@martin.st> Message-ID: <81409a7e-e810-c098-25ee-9f10932aa84b@martin.st> References: <82e16738-3cb3-b4e8-cab5-10e9f58622c4@yandex.ru> <7542af15-2e7-eba5-8a97-b8eb8ce8c8d9@martin.st> MIME-Version: 1.0 X-FE-Policy-ID: 3:14:2:SYSTEM X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH] avcodec/aarch64: Access externs via GOT with PIC X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="iso-8859-15"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Mon, 11 Jul 2022, Martin Storsj=F6 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` ma= cro = >> 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 comput= ed = >> 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 linke= r = >> 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 wi= th = > -Wl,-Bsymbolic, which means that those symbol references are bound at lin= k = > 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,-Bsymbo= lic = > 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".