#[cfg(test)]
mod test;
#[derive(Eq, PartialEq, Debug, Clone, Copy)]
#[allow(non_camel_case_types)]
#[repr(u32)]
pub enum RelocationTypes {
R_386_NONE,
R_386_32,
R_386_PC32,
R_386_GOT32,
R_386_PLT32,
R_386_COPY,
R_386_GLOB_DAT,
R_386_JMP_SLOT,
R_386_RELATIVE,
R_386_GOTOFF,
R_386_GOTPC,
R_386_32PLT,
R_386_16,
R_386_PC16,
R_386_8,
R_386_PC8,
R_386_SIZE32,
Unknown(u32),
}
impl RelocationTypes {
pub fn from(typ: u32) -> RelocationTypes {
use RelocationTypes::*;
match typ {
0 => R_386_NONE,
1 => R_386_PC32,
2 => R_386_32,
3 => R_386_GOT32,
4 => R_386_PLT32,
5 => R_386_COPY,
6 => R_386_GLOB_DAT,
7 => R_386_JMP_SLOT,
8 => R_386_RELATIVE,
9 => R_386_GOTOFF,
10 => R_386_GOTPC,
11 => R_386_32PLT,
20 => R_386_16,
21 => R_386_PC16,
22 => R_386_8,
23 => R_386_PC8,
38 => R_386_SIZE32,
x => Unknown(x),
}
}
}