Skip to content

Commit 63eb3b7

Browse files
committed
Auto merge of #1076 - sfackler:more-elf, r=alexcrichton
Add a couple more ELF types
2 parents 267375e + 0f46120 commit 63eb3b7

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

libc-test/build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,11 @@ fn main() {
362362
"Elf32_Shdr" |
363363
"Elf64_Shdr" |
364364
"Elf32_Sym" |
365-
"Elf64_Sym" => ty.to_string(),
365+
"Elf64_Sym" |
366+
"Elf32_Ehdr" |
367+
"Elf64_Ehdr" |
368+
"Elf32_Chdr" |
369+
"Elf64_Chdr" => ty.to_string(),
366370

367371
// Fixup a few types on windows that don't actually exist.
368372
"time64_t" if windows => "__time64_t".to_string(),

src/unix/notbsd/linux/mod.rs

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,40 @@ s! {
483483
pub dlpi_tls_data: *mut ::c_void,
484484
}
485485

486+
pub struct Elf32_Ehdr {
487+
pub e_ident: [::c_uchar; 16],
488+
pub e_type: Elf32_Half,
489+
pub e_machine: Elf32_Half,
490+
pub e_version: Elf32_Word,
491+
pub e_entry: Elf32_Addr,
492+
pub e_phoff: Elf32_Off,
493+
pub e_shoff: Elf32_Off,
494+
pub e_flags: Elf32_Word,
495+
pub e_ehsize: Elf32_Half,
496+
pub e_phentsize: Elf32_Half,
497+
pub e_phnum: Elf32_Half,
498+
pub e_shentsize: Elf32_Half,
499+
pub e_shnum: Elf32_Half,
500+
pub e_shstrndx: Elf32_Half,
501+
}
502+
503+
pub struct Elf64_Ehdr {
504+
pub e_ident: [::c_uchar; 16],
505+
pub e_type: Elf64_Half,
506+
pub e_machine: Elf64_Half,
507+
pub e_version: Elf64_Word,
508+
pub e_entry: Elf64_Addr,
509+
pub e_phoff: Elf64_Off,
510+
pub e_shoff: Elf64_Off,
511+
pub e_flags: Elf64_Word,
512+
pub e_ehsize: Elf64_Half,
513+
pub e_phentsize: Elf64_Half,
514+
pub e_phnum: Elf64_Half,
515+
pub e_shentsize: Elf64_Half,
516+
pub e_shnum: Elf64_Half,
517+
pub e_shstrndx: Elf64_Half,
518+
}
519+
486520
pub struct Elf32_Sym {
487521
pub st_name: Elf32_Word,
488522
pub st_value: Elf32_Addr,
@@ -549,6 +583,19 @@ s! {
549583
pub sh_entsize: Elf64_Xword,
550584
}
551585

586+
pub struct Elf32_Chdr {
587+
pub ch_type: Elf32_Word,
588+
pub ch_size: Elf32_Word,
589+
pub ch_addralign: Elf32_Word,
590+
}
591+
592+
pub struct Elf64_Chdr {
593+
pub ch_type: Elf64_Word,
594+
pub ch_reserved: Elf64_Word,
595+
pub ch_size: Elf64_Xword,
596+
pub ch_addralign: Elf64_Xword,
597+
}
598+
552599
pub struct ucred {
553600
pub pid: ::pid_t,
554601
pub uid: ::uid_t,

0 commit comments

Comments
 (0)