Skip to content

Commit

Permalink
elf: complete some constants (#296)
Browse files Browse the repository at this point in the history
* complete E_MACHINE constants
* complete E_TYPE constants
* defined SHF_EXCLUDE
  • Loading branch information
n01e0 authored Dec 28, 2021
1 parent 46b6a47 commit f2fe5f4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/elf/constants_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ pub const EM_BA2: u16 = 202;
pub const EM_XCORE: u16 = 203;
/// Microchip 8-bit PIC(r)
pub const EM_MCHP_PIC: u16 = 204;
// reserved 205-209
/// Intel Graphics Technology
pub const EM_INTELGT: u16 = 205;
// reserved 206-209
/// KM211 KM32
pub const EM_KM32: u16 = 210;
/// KM211 KMX32
Expand Down Expand Up @@ -371,6 +373,9 @@ pub const EM_RISCV: u16 = 243;
/// Linux BPF -- in-kernel virtual machine
pub const EM_BPF: u16 = 247;

/// C-SKY
pub const EM_CSKY: u16 = 252;

pub const EM_NUM: u16 = 248;

/// Convert machine to str representation
Expand Down
8 changes: 8 additions & 0 deletions src/elf/header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ pub const ET_DYN: u16 = 3;
pub const ET_CORE: u16 = 4;
/// Number of defined types.
pub const ET_NUM: u16 = 5;
/// OS-specific range start
pub const ET_LOOS: u16 = 0xfe00;
/// OS-specific range end
pub const ET_HIOS: u16 = 0xfeff;
/// Processor-specific range start
pub const ET_LOPROC: u16 = 0xff00;
/// Processor-specific range end
pub const ET_HIPROC: u16 = 0xffff;

/// The ELF magic number.
pub const ELFMAG: &[u8; 4] = b"\x7FELF";
Expand Down
4 changes: 2 additions & 2 deletions src/elf/section_header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ pub const SHF_MASKPROC: u32 = 0xf000_0000;
pub const SHF_ORDERED: u32 = 1 << 30;
/// Number of "regular" section header flags
pub const SHF_NUM_REGULAR_FLAGS: usize = 12;
// /// Section is excluded unless referenced or allocated (Solaris).
// pub const SHF_EXCLUDE: u32 = 1U << 31;
/// Section is excluded unless referenced or allocated (Solaris).
pub const SHF_EXCLUDE: u32 = 0x80000000; // 1U << 31

pub const SHF_FLAGS: [u32; SHF_NUM_REGULAR_FLAGS] = [
SHF_WRITE,
Expand Down

0 comments on commit f2fe5f4

Please sign in to comment.