pub enum Reference {
Call,
Data,
Got,
Address {
bytes: u8,
},
}Expand description
What kind of thing a relocation is asking the linker for.
The first three are the distance from the end of an instruction to something, which is what every reference the code makes is, because this compiler generates position independent code and nothing else. They are told apart by what the linker is allowed to do about each one. The fourth is not a distance at all and is the only kind an image asks for, since an initializer holding the address of something holds the address itself.
Variants§
Call
A call, which the linker may satisfy with a stub that reaches further than the four bytes
would. R_X86_64_PLT32 on ELF, and the same relocation a branch gets on the other two.
Data
A datum, reached from the instruction pointer. R_X86_64_PC32 on ELF.
Got
A slot of the global offset table, reached from the instruction pointer, holding the address of something another object may be the one that defines.
The distance to the slot rather than to the thing, which is the whole difference: the
distance to the thing is a number only a link that puts the thing in this program can
work out, and a shared library is a link that does not. R_X86_64_REX_GOTPCRELX on ELF,
which says the instruction is a mov with a REX prefix and lets the linker turn it back
into the lea it would have been if the symbol had been here all along.
Address
The address itself, written into an image. int *p = &y; and nothing else in C.
Trait Implementations§
impl Copy for Reference
impl Eq for Reference
impl StructuralPartialEq for Reference
Auto Trait Implementations§
impl Freeze for Reference
impl RefUnwindSafe for Reference
impl Send for Reference
impl Sync for Reference
impl Unpin for Reference
impl UnsafeUnpin for Reference
impl UnwindSafe for Reference
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.