https://bugs.winehq.org/show_bug.cgi?id=38780
--- Comment #3 from André H. nerv@dawncrow.de --- (In reply to Anastasius Focht from comment #5 from bug 38719)
No special treatment, it's really used as general purpose register.
The _dl_tlsdesc* X18 references result from NSAVEXREGPAIRS macro usage:
https://sourceware.org/git/?p=glibc.git;a=blob;f=sysdeps/aarch64/dl-tlsdesc. S;h=be9b9b394c1aea8f3dfc1f0a9c4c32e002004822;hb=HEAD
First we should note that x18 is either the "platform register" or a temporary register. I think the macros in the linked code are fine, they just save and restore x18 and others (push/pop). The problem really is the compiler here as already mentioned by you.