pub struct Padding {
pub name: &'static str,
pub before: u32,
pub after: u32,
}Expand description
The room at the top of a function for something to be written over later, in a function that was promised any.
What -fpatchable-function-entry= asks for. The room is a run of the shortest instruction the
machine has that does nothing, and what makes it worth reserving is that it is never run for
long: a tracer or a live patcher writes a jump or a call over it once the program is up, and
what it needs from the compiler is a known address and a known number of bytes.
Two counts because the room can be on either side of the function’s own label. Only the half after it is written here, since the stream starts at the label and there is nowhere in it to put the other half; the half in front is carried through so that whatever lays the function down can lay that many bytes ahead of the symbol.
Fields§
§name: &'static strWhat the instruction that does nothing is called on this target.
before: u32How many of them go in front of the function’s own label.
after: u32How many go after it.