[PATCH] libio: Properly link in libio functions in static binaries
Xi Ruoyao
xry111@xry111.site
Thu Aug 21 17:03:08 GMT 2025
On Thu, 2025-08-21 at 07:17 -0700, H.J. Lu wrote:
> commit 3020f72618e4f1d7338cd42b8bc7b2813e961b5a
> Author: Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>
> Date: Tue Dec 27 18:11:43 2022 -0300
>
> libio: Remove the usage of __libc_IO_vtables
>
> added
>
> #define libio_static_fn_required(name) __asm (".globl " #name);
>
> to link in libio functions in static binaries. But there is no relocation
> in
> .globl _IO_file_open
>
> and "strip --strip-unneeded" will remove such unreferenced symbols which
> breaks static binaries. Redefine libio_static_fn_required to create a
> reference to the required function with
>
> .pushsection ".data.rel.ro.local","aw"
> .L_IO_file_open:
> .dc.a _IO_file_open
> .popsection
>
> This fixes BZ #33300.
>
> Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Tested-by: Xi Ruoyao <xry111@xry111.site>
--
Xi Ruoyao <xry111@xry111.site>
More information about the Libc-alpha
mailing list