# Prevent register clobbering on x86_64 threadlocal access · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/fc78a61c4c6dd2a8a1047b5e5b62037e82b0dca0)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: fc78a61c4c6dd2a8a1047b5e5b62037e82b0dca0

Requested commit: fc78a61c4c6dd2a8a1047b5e5b62037e82b0dca0

Commit: fc78a61c4c6dd2a8a1047b5e5b62037e82b0dca0

Tree: bdf9ea1d5b3fe99449c0acffbebc9f5580927dbd

Author: Mick Sayson

Committer: mlugg

## Message

```
Prevent register clobbering on x86_64 threadlocal access

On the x86_64 self hosted backend, thread locals are accessed through
__tls_get_addr on PIC. Usually this goes through a fast path which does
not lose any registers, however in some cases (notably any dlopened
library on my machine) this can take a slow path which calls out to C
ABI functions

Catch this case and backup registers as necessary

Fix a few other ones while we're here. Credit to mlugg

Fixes #30183

```

## Parents

- [b9eefe17af2c30855f229f5214679d3766966b85](https://git.cafe/gitcafe/zig/commit/b9eefe17af2c30855f229f5214679d3766966b85?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/fc78a61c4c6dd2a8a1047b5e5b62037e82b0dca0?format=markdown)
