Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
btf: Implement support for bitfield relocations
Bitfields are implemented by computing a new load size and offset for the target by starting with a 1 byte load at the offset of the target bitfield and growing the load size until we either capture the bitfield, or go over 8 bytes. This algorithm differs from the one in libbpf which uses the original load size and grows it to capture the field, which may overrun the size of the struct if the bitfield is moved around close to the end of the struct. The left and right shifts for the target are then adjusted accordingly the same way as in libbpf. Since we don't know the size of the loads decided by the compiler we cannot compute "local" and cannot validate that when doing the relocation and hence I refactored the code to make COREFixup.Local optional. Signed-off-by: Jussi Maki <jussi@isovalent.com>
- Loading branch information
Showing
5 changed files
with
179 additions
and
59 deletions.
There are no files selected for viewing
This file contains 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
Oops, something went wrong.