Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Mach-O thread local variables #68

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Popax21
Copy link

@Popax21 Popax21 commented Feb 28, 2023

This patch adds support for thread local sections, which were previously unimplemented. Specifically, it allows the user to emit sections with the types S_THREAD_LOCAL_REGULAR (for .tdata and the new thread_data section attribute) and S_THREAD_LOCAL_ZEROFILL (for .tbss and the new thread_bss/zerofill attribute). Additionally, it also maps specific section names to the section types S_THREAD_LOCAL_VARIABLES (__thread_vars), S_THREAD_LOCAL_VARIABLE_POINTERS (__thread_ptrs) and S_THREAD_LOCAL_INIT_FUNCTION_POINTERS (__thread_init - note that I couldn't determine how this section type is usually named, so I chose my own name). These special section names don't have an associated Unix section name, yet are sometimes still required when interacting with thread local variables.

I hereby sign off the Developer’s Certificate of Origin 1.1.

This patch adds support for thread local sections, which were previously unimplemented. Specifically, it allows the user to emit sections with the types `S_THREAD_LOCAL_REGULAR` (for `.tdata` and the new `thread_data` section attribute) and `S_THREAD_LOCAL_ZEROFILL` (for `.tbss` and the new `thread_bss/zerofill` attribute). Additionally, it also maps specific section names to the section types `S_THREAD_LOCAL_VARIABLES` (`__thread_vars`), `S_THREAD_LOCAL_VARIABLE_POINTERS` (`__thread_ptrs`) and `S_THREAD_LOCAL_INIT_FUNCTION_POINTERS` (`__thread_init` - note that I couldn't determine how this section type is usually named, so I chose my own name). These special section names don't have an associated Unix section name, yet are sometimes still required when interacting with thread local variables.

I hereby sign off the Developer’s Certificate of Origin 1.1.
@sezero
Copy link
Contributor

sezero commented Oct 11, 2023

Has this been reviewed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants