]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[zbin] Allow for constructing compressed dynamic relocation records
authorMichael Brown <mcb30@ipxe.org>
Tue, 6 May 2025 11:11:56 +0000 (12:11 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 6 May 2025 11:11:56 +0000 (12:11 +0100)
commit70bb5e5e63453f5b931de9c5cc88df8d510462fb
tree930280fa11e4ca847e55923fcb8a6aa7f39213f2
parent98646b9f016d9bff91a5c89f402aeb452ee7f84b
[zbin] Allow for constructing compressed dynamic relocation records

Define a new "ZREL" compressor information block, describing a block
of Elf_Rel or Elf_Rela runtime relocations to be converted to an
iPXE-specific compressed relocation format.

The compressed relocation format is based loosely on the Elf_Relr
bitmap+offset format, with some optimisations for use in iPXE.  In
particular:

  - a relative "skip" value is used instead of an absolute offset

  - the width of the skip value is reduced to 19 bits (when present)

  - an explicit skip value of zero is used to terminate the list

  - unaligned relocations are prohibited

The layout of bits within the compressed relocation record is also
adjusted to make assembly code implementations simpler: the skip flag
bit is placed in the MSB so that it can be tested using "bltz" or
similar instructions, and the skip value is placed above the
relocation flag bits so that a typical shifting implementation will
naturally end up with a zero value in its accumulator if and only if
the record was a terminator.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/util/zbin.c