-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-11188: Error when building TSRM in ARM64 #11236
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
Conversation
7deb52a
to
068e554
Compare
I think the code to fetch the TCB offset is good, but unfortunately I don't think we can cache the TCB offset unless we are using the local-exec or initial-exec models, because this offset may be different in each thread (as the dynamic TLS block of the module is allocated separately in each thread). We do it on some platforms, but I believe that are relying on surplus Static TLS Space in these platforms. When loading apache mod_php on freebsd aarch64, our TLS block is allocated dynamically. I found about this because the assertion We should probably return |
Interesting, thanks for the review! |
I've merged #13928 |
Thanks, I will be able to allocate time for this tomorrow to rebase and finish this PR. |
It took a little while longer because the software emulation slowed me down, but hopefully I did it right. At least it seems to work locally, but best double check. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
ext/opcache/jit/zend_jit_arm64.dasc
Outdated
/* https://github.com/freebsd/freebsd-src/blob/c52ca7dd09066648b1cc40f758289404d68ab886/libexec/rtld-elf/aarch64/reloc.c#L225-L233 */ | ||
TLSDescriptor *tlsdesc = where[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We may mention the ABI here, as it specifies that where points to two GOT entries, and the second one holds the information we need. This information is platform-specific though:
The first entry holds a pointer to the variable's TLS descriptor resolver function and the second entry holds a platform-specific offset or pointer.
Although the issue mentioned FreeBSD, this is a broader problem: the current ARM64 code to load the TLS offset assumes a setup with the non-default TLS model. This problem can also apply on some configurations on other platforms.
Thanks for the link & review, updated the comment.
Sounds good? |
Yes this sound like a good plan |
This change is necessary to support php/php-src#11236 for IR JIT.
This change is necessary to support php/php-src#11236 for IR JIT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't check this. Feel free to merge this. (the IR part already in master).
This is phpGH-11236 for IR JIT.
Although the issue mentioned FreeBSD, this is a broader problem:
the current ARM64 code to load the TLS offset assumes a setup with
the non-default TLS model. This problem can also apply on some
configurations on other platforms.