Skip to content

Commit

Permalink
thread_local_mac: Mention S_THREAD_LOCAL_VARIABLES
Browse files Browse the repository at this point in the history
  • Loading branch information
nico committed Aug 2, 2024
1 parent 9a635cb commit f2fa294
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions notes/thread_local_mac.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ The executable also stores metadata for each thread-local variable in the
(initially nullptr when TLS isn't initialized for the current thread yet)
* the offset of this variable in that block

`__DATA,__thread_vars` has type `S_THREAD_LOCAL_VARIABLES` (see `otool -lv`
output). dyld identifies TLV descriptors based on this section type.

When you reference a thread-local variable in your code, this gets compiled to
a call to the function returning the variable's address. The dynamic linker
sets this function to `tlv_get_addr` (a dyld-internal function) for every
Expand Down

0 comments on commit f2fa294

Please sign in to comment.