def __post_init__(self) -> None:
self.func = _PATCH_FUNCS[self.kind]
- def fold(
- self,
- other: typing.Self,
- body: bytes | bytearray,
- ) -> typing.Self | None:
+ def fold(self, other: typing.Self, body: bytearray) -> typing.Self | None:
"""Combine two holes into a single hole, if possible."""
instruction_a = int.from_bytes(
body[self.offset : self.offset + 4], byteorder=sys.byteorder
raise NotImplementedError(type(self))
def _handle_relocation(
- self, base: int, relocation: _R, raw: bytes | bytearray
+ self, base: int, relocation: _R, raw: bytearray
) -> _stencils.Hole:
raise NotImplementedError(type(self))
return _stencils.symbol_to_value(name)
def _handle_relocation(
- self,
- base: int,
- relocation: _schema.COFFRelocation,
- raw: bytes | bytearray,
+ self, base: int, relocation: _schema.COFFRelocation, raw: bytearray
) -> _stencils.Hole:
match relocation:
case {
}, section_type
def _handle_relocation(
- self,
- base: int,
- relocation: _schema.ELFRelocation,
- raw: bytes | bytearray,
+ self, base: int, relocation: _schema.ELFRelocation, raw: bytearray
) -> _stencils.Hole:
symbol: str | None
match relocation:
stencil.holes.append(hole)
def _handle_relocation(
- self,
- base: int,
- relocation: _schema.MachORelocation,
- raw: bytes | bytearray,
+ self, base: int, relocation: _schema.MachORelocation, raw: bytearray
) -> _stencils.Hole:
symbol: str | None
match relocation: