ruby: support EC offset extraction for statically-linked Ruby#28
Draft
ruby: support EC offset extraction for statically-linked Ruby#28
Conversation
Member
Author
Coredump Test PlanThis PR needs a coredump test for a statically-linked Ruby binary (no Test:
|
For statically-linked Ruby binaries (bin/ruby rather than libruby.so), TLS descriptors are not available. Instead, rb_current_ec_noinline accesses the execution context directly via a TP-relative offset (FS:offset on x86_64, MRS tpidr_el0 + ADD on aarch64). This reuses the asm/amd.ExtractTLSOffset and asm/arm.ExtractTLSOffset infrastructure from the Python TLS PR (open-telemetry#1109) to disassemble rb_current_ec_noinline and extract the offset. Also changes current_ec_tpbase_tls_offset from u64 to s64 since static TLS offsets (local exec model) are negative on x86_64.
c3ca8b5 to
64117f2
Compare
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
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.
For statically-linked Ruby binaries (bin/ruby rather than libruby.so), TLS descriptors are not available. Instead, rb_current_ec_noinline accesses the execution context directly via a TP-relative offset (FS:offset on x86_64, MRS tpidr_el0 + ADD on aarch64).
This reuses the asm/amd.ExtractTLSOffset and asm/arm.ExtractTLSOffset infrastructure from the Python TLS PR (open-telemetry#1109) to disassemble rb_current_ec_noinline and extract the offset.
Also changes current_ec_tpbase_tls_offset from u64 to s64 since static TLS offsets (local exec model) are negative on x86_64.