From 063c721c96e9aba3a2e5123bf6369529b80839e5 Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Sun, 2 Sep 2018 20:52:22 -0700 Subject: Add some more elf types --- libc-test/build.rs | 6 +++++- src/unix/notbsd/linux/mod.rs | 48 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index d46372b44b..f003a32da7 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -358,7 +358,11 @@ fn main() { "Dl_info" | "DIR" | "Elf32_Phdr" | - "Elf64_Phdr" => ty.to_string(), + "Elf64_Phdr" | + "Elf32_Shdr" | + "Elf64_Shdr" | + "Elf32_Sym" | + "Elf64_Sym" => ty.to_string(), // Fixup a few types on windows that don't actually exist. "time64_t" if windows => "__time64_t".to_string(), diff --git a/src/unix/notbsd/linux/mod.rs b/src/unix/notbsd/linux/mod.rs index 6bc7db191c..20cc10cc59 100644 --- a/src/unix/notbsd/linux/mod.rs +++ b/src/unix/notbsd/linux/mod.rs @@ -33,6 +33,10 @@ pub type Elf64_Word = u32; pub type Elf64_Off = u64; pub type Elf64_Addr = u64; pub type Elf64_Xword = u64; +pub type Elf64_Sxword = i64; + +pub type Elf32_Section = u16; +pub type Elf64_Section = u16; pub enum fpos64_t {} // TODO: fill this out with a struct @@ -479,6 +483,24 @@ s! { pub dlpi_tls_data: *mut ::c_void, } + pub struct Elf32_Sym { + pub st_name: Elf32_Word, + pub st_value: Elf32_Addr, + pub st_size: Elf32_Word, + pub st_info: ::c_uchar, + pub st_other: ::c_uchar, + pub st_shndx: Elf32_Section, + } + + pub struct Elf64_Sym { + pub st_name: Elf64_Word, + pub st_info: ::c_uchar, + pub st_other: ::c_uchar, + pub st_shndx: Elf64_Section, + pub st_value: Elf64_Addr, + pub st_size: Elf64_Xword, + } + pub struct Elf32_Phdr { pub p_type: Elf32_Word, pub p_offset: Elf32_Off, @@ -501,6 +523,32 @@ s! { pub p_align: Elf64_Xword, } + pub struct Elf32_Shdr { + pub sh_name: Elf32_Word, + pub sh_type: Elf32_Word, + pub sh_flags: Elf32_Word, + pub sh_addr: Elf32_Addr, + pub sh_offset: Elf32_Off, + pub sh_size: Elf32_Word, + pub sh_link: Elf32_Word, + pub sh_info: Elf32_Word, + pub sh_addralign: Elf32_Word, + pub sh_entsize: Elf32_Word, + } + + pub struct Elf64_Shdr { + pub sh_name: Elf64_Word, + pub sh_type: Elf64_Word, + pub sh_flags: Elf64_Xword, + pub sh_addr: Elf64_Addr, + pub sh_offset: Elf64_Off, + pub sh_size: Elf64_Xword, + pub sh_link: Elf64_Word, + pub sh_info: Elf64_Word, + pub sh_addralign: Elf64_Xword, + pub sh_entsize: Elf64_Xword, + } + pub struct ucred { pub pid: ::pid_t, pub uid: ::uid_t, -- cgit v1.2.1