Split btf support#1593
Open
altugbozkurt07 wants to merge 2 commits into
Open
Conversation
Collect extern symbols from object BTF and fix up the .ksyms datasec so the resulting BTF is acceptable to the kernel. Resolve typed extern vars and kfuncs through kernel BTF. Fall back to /proc/kallsyms for typeless vars, then apply the corresponding extern relocations before program load. Expose the object-level ksym APIs in aya-obj via Object::resolve_externs(), Object::relocate_externs(), and KsymsError. Weak extern handling follows libbpf-style behavior. Unresolved weak var references are null-patched, unresolved weak kfunc calls are poisoned, and unresolved strong extern relocations are rejected. Add integration coverage for typed ksyms, typed kfuncs, kallsyms-backed ksyms, and missing strong-symbol failures.
Model split BTF as a borrowed view over base and split BTF objects instead of storing base BTF state inside Btf itself. This keeps Btf as a standalone parsed metadata blob while allowing lookup code to resolve type IDs and string offsets through the combined split-BTF namespace. Move shared type walking helpers behind BtfView and make type/field compatibility generic over that view. Existing callers still use Btf directly, while module-BTF resolution can pass SplitBtf in a follow-up.
✅ Deploy Preview for aya-rs-docs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Model split BTF as a borrowed view over base and split BTF objects instead of storing base BTF state inside
Btfitself.This builds on the ksyms support in #1372. That PR resolves typed extern ksyms against vmlinux BTF, but module-defined kfuncs and variables are described by split BTF: the module BTF references types and strings from the base vmlinux BTF while also defining its own module-local types.
This PR adds a
BtfViewabstraction for shared lookup behavior and aSplitBtfview that resolves visible type IDs and string offsets across the combined base/module BTF namespace.Btfremains a standalone parsed metadata blob, while code that needs module-BTF lookup can operate through the view.The type compatibility helpers are now generic over
BtfView, so existing callers can keep passingBtfdirectly, and the follow-up module-BTF ksym fallback PR can passSplitBtfwhen resolving externs against module BTF.Added unit coverage for split-BTF type resolution and compatibility checks across the base/module boundary. No integration tests are included here because this PR only introduces the reusable view abstraction; the follow-up module-BTF ksym PR exercises it through loader behavior.
This change is