GCC and the GNU2 TLS descriptor call ABI

35 views
Skip to first unread message

Florian Weimer

unread,
Feb 11, 2024, 9:03:04 AMFeb 11
to x86-6...@googlegroups.com
GCC assumes that the GNU2 TLS descriptor function does not clobber
vector registers:

GNU2 TLS descriptor calls do not follow psABI on x86_64-linux-gnu
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113874>

Is this a GCC bug? Or do we need to fix glibc?

There are two ways to fix this in the dynamic linker: perform a full
context switch (like for lazy binding, probably using XSAVE/XRESTOR), or
perform all TLS allocation during relocation, so that the slow path that
clobbers vector registers is gone.

Thanks,
Florian

H.J. Lu

unread,
Feb 11, 2024, 9:25:10 AMFeb 11
to Florian Weimer, x86-6...@googlegroups.com
On Sun, Feb 11, 2024 at 6:03 AM Florian Weimer <fwe...@redhat.com> wrote:
>
> GCC assumes that the GNU2 TLS descriptor function does not clobber
> vector registers:
>
> GNU2 TLS descriptor calls do not follow psABI on x86_64-linux-gnu
> <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113874>
>
> Is this a GCC bug? Or do we need to fix glibc?
>
> There are two ways to fix this in the dynamic linker: perform a full
> context switch (like for lazy binding, probably using XSAVE/XRESTOR), or

I don't think it works well.

> perform all TLS allocation during relocation, so that the slow path that
> clobbers vector registers is gone.
>

This can add more complexity to ld.so.

--
H.J.

H.J. Lu

unread,
Feb 11, 2024, 10:27:57 AMFeb 11
to Florian Weimer, x86-6...@googlegroups.com
We can add dynamic tags to mark TLSDESC relocations to help ld.so.

--
H.J.
Reply all
Reply to author
Forward
0 new messages