-
Notifications
You must be signed in to change notification settings - Fork 373
Add support for Mach-O thread local variables #68
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
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Has this been reviewed?
This is great, but it needs documentation. It might possibly be nicer to use "wrt ..tls" for compatibility with ELF, though.
Question: right now we don't have anyone on the NASM team who is familiar with the intricacies of MachO. Would you be able to help with information and/or validation if we need to make changes that affect the MachO backend?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 newthread_data
section attribute) andS_THREAD_LOCAL_ZEROFILL
(for.tbss
and the newthread_bss/zerofill
attribute). Additionally, it also maps specific section names to the section typesS_THREAD_LOCAL_VARIABLES
(__thread_vars
),S_THREAD_LOCAL_VARIABLE_POINTERS
(__thread_ptrs
) andS_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.