summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2018-09-02 20:52:22 -0700
committerSteven Fackler <sfackler@gmail.com>2018-09-02 22:08:44 -0700
commit063c721c96e9aba3a2e5123bf6369529b80839e5 (patch)
treed489decf4106a70eb5a9d075aeb993fdc0227c97
parentb9a0e23e84d2ae5aa580838831206da64d6473cf (diff)
downloadrust-libc-063c721c96e9aba3a2e5123bf6369529b80839e5.tar.gz
Add some more elf types
-rw-r--r--libc-test/build.rs6
-rw-r--r--src/unix/notbsd/linux/mod.rs48
2 files changed, 53 insertions, 1 deletions
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,