# always respect threadlocal for variables with external linkage · gitcafe/zig

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

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

Visibility: public

Requested revision: bd9c629c4c306c9159a5e6ad16fe5637d2bc6dbf

Requested commit: bd9c629c4c306c9159a5e6ad16fe5637d2bc6dbf

Commit: bd9c629c4c306c9159a5e6ad16fe5637d2bc6dbf

Tree: f7f07bc1a38c20e4ebb77a4e4445b3c73213ff33

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
always respect threadlocal for variables with external linkage

Previously if you had, for example:

extern "c" threadlocal var errno: c_int;

This would turn errno into a normal variable for --single-threaded
builds. However for variables with external linkage, there is an ABI
to uphold.

This is needed to make errno work for DragonFly BSD. See #2381.

```

## Parents

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

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