Skip to content

Commit 4cdc32e

Browse files
committed
Auto merge of #3325 - Vtewari2311:libc-hurd-latest, r=JohnTitor
added support for GNU/Hurd added initial support for i686-unknown-hurd-gnu
2 parents aa065c6 + d2e08ef commit 4cdc32e

File tree

7 files changed

+3297
-1
lines changed

7 files changed

+3297
-1
lines changed

build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const ALLOWED_CFGS: &'static [&'static str] = &[
3333

3434
// Extra values to allow for check-cfg.
3535
const CHECK_CFG_EXTRA: &'static [(&'static str, &'static [&'static str])] = &[
36-
("target_os", &["switch", "aix", "ohos"]),
36+
("target_os", &["switch", "aix", "ohos", "hurd"]),
3737
("target_env", &["illumos", "wasi", "aix", "ohos"]),
3838
(
3939
"target_arch",

src/unix/hurd/align.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
// Placeholder file

src/unix/hurd/b32.rs

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
pub type c_long = i32;
2+
pub type c_ulong = u32;
3+
4+
pub type __int64_t = ::c_longlong;
5+
pub type __uint64_t = ::c_ulonglong;
6+
7+
pub type int_fast16_t = ::c_int;
8+
pub type int_fast32_t = ::c_int;
9+
pub type int_fast64_t = ::c_longlong;
10+
pub type uint_fast16_t = ::c_uint;
11+
pub type uint_fast32_t = ::c_uint;
12+
pub type uint_fast64_t = ::c_ulonglong;
13+
14+
pub type __quad_t = ::c_longlong;
15+
pub type __u_quad_t = ::c_ulonglong;
16+
pub type __intmax_t = ::c_longlong;
17+
pub type __uintmax_t = ::c_ulonglong;
18+
19+
pub type __squad_type = ::__int64_t;
20+
pub type __uquad_type = ::__uint64_t;
21+
pub type __sword_type = ::c_int;
22+
pub type __uword_type = ::c_uint;
23+
pub type __slong32_type = ::c_long;
24+
pub type __ulong32_type = ::c_ulong;
25+
pub type __s64_type = ::__int64_t;
26+
pub type __u64_type = ::__uint64_t;
27+
28+
pub type Elf32_Half = u16;
29+
pub type Elf32_Word = u32;
30+
pub type Elf32_Off = u32;
31+
pub type Elf32_Addr = u32;
32+
pub type Elf32_Section = u16;
33+
34+
pub type Elf_Addr = ::Elf32_Addr;
35+
pub type Elf_Half = ::Elf32_Half;
36+
pub type Elf_Ehdr = ::Elf32_Ehdr;
37+
pub type Elf_Phdr = ::Elf32_Phdr;
38+
pub type Elf_Shdr = ::Elf32_Shdr;
39+
pub type Elf_Sym = ::Elf32_Sym;
40+
41+
s! {
42+
pub struct Elf32_Ehdr {
43+
pub e_ident: [::c_uchar; 16],
44+
pub e_type: Elf32_Half,
45+
pub e_machine: Elf32_Half,
46+
pub e_version: Elf32_Word,
47+
pub e_entry: Elf32_Addr,
48+
pub e_phoff: Elf32_Off,
49+
pub e_shoff: Elf32_Off,
50+
pub e_flags: Elf32_Word,
51+
pub e_ehsize: Elf32_Half,
52+
pub e_phentsize: Elf32_Half,
53+
pub e_phnum: Elf32_Half,
54+
pub e_shentsize: Elf32_Half,
55+
pub e_shnum: Elf32_Half,
56+
pub e_shstrndx: Elf32_Half,
57+
}
58+
59+
pub struct Elf32_Shdr {
60+
pub sh_name: Elf32_Word,
61+
pub sh_type: Elf32_Word,
62+
pub sh_flags: Elf32_Word,
63+
pub sh_addr: Elf32_Addr,
64+
pub sh_offset: Elf32_Off,
65+
pub sh_size: Elf32_Word,
66+
pub sh_link: Elf32_Word,
67+
pub sh_info: Elf32_Word,
68+
pub sh_addralign: Elf32_Word,
69+
pub sh_entsize: Elf32_Word,
70+
}
71+
72+
pub struct Elf32_Sym {
73+
pub st_name: Elf32_Word,
74+
pub st_value: Elf32_Addr,
75+
pub st_size: Elf32_Word,
76+
pub st_info: ::c_uchar,
77+
pub st_other: ::c_uchar,
78+
pub st_shndx: Elf32_Section,
79+
}
80+
81+
pub struct Elf32_Phdr {
82+
pub p_type: ::Elf32_Word,
83+
pub p_offset: ::Elf32_Off,
84+
pub p_vaddr: ::Elf32_Addr,
85+
pub p_paddr: ::Elf32_Addr,
86+
pub p_filesz: ::Elf32_Word,
87+
pub p_memsz: ::Elf32_Word,
88+
pub p_flags: ::Elf32_Word,
89+
pub p_align: ::Elf32_Word,
90+
}
91+
}

src/unix/hurd/b64.rs

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
pub type c_long = i64;
2+
pub type c_ulong = u64;
3+
4+
pub type __int64_t = ::c_long;
5+
pub type __uint64_t = ::c_ulong;
6+
7+
pub type int_fast16_t = ::c_long;
8+
pub type int_fast32_t = ::c_long;
9+
pub type int_fast64_t = ::c_long;
10+
pub type uint_fast16_t = ::c_ulong;
11+
pub type uint_fast32_t = ::c_ulong;
12+
pub type uint_fast64_t = ::c_ulong;
13+
14+
pub type __quad_t = ::c_long;
15+
pub type __u_quad_t = ::c_ulong;
16+
pub type __intmax_t = ::c_long;
17+
pub type __uintmax_t = ::c_ulong;
18+
19+
pub type __squad_type = ::c_long;
20+
pub type __uquad_type = ::c_ulong;
21+
pub type __sword_type = ::c_long;
22+
pub type __uword_type = ::c_ulong;
23+
pub type __slong32_type = ::c_int;
24+
pub type __ulong32_type = ::c_uint;
25+
pub type __s64_type = ::c_long;
26+
pub type __u64_type = ::c_ulong;
27+
28+
pub type Elf64_Half = u16;
29+
pub type Elf64_Word = u32;
30+
pub type Elf64_Off = u64;
31+
pub type Elf64_Addr = u64;
32+
pub type Elf64_Xword = u64;
33+
pub type Elf64_Sxword = i64;
34+
pub type Elf64_Section = u16;
35+
36+
pub type Elf_Addr = ::Elf64_Addr;
37+
pub type Elf_Half = ::Elf64_Half;
38+
pub type Elf_Ehdr = ::Elf64_Ehdr;
39+
pub type Elf_Phdr = ::Elf64_Phdr;
40+
pub type Elf_Shdr = ::Elf64_Shdr;
41+
pub type Elf_Sym = ::Elf64_Sym;
42+
43+
s! {
44+
pub struct Elf64_Ehdr {
45+
pub e_ident: [::c_uchar; 16],
46+
pub e_type: Elf64_Half,
47+
pub e_machine: Elf64_Half,
48+
pub e_version: Elf64_Word,
49+
pub e_entry: Elf64_Addr,
50+
pub e_phoff: Elf64_Off,
51+
pub e_shoff: Elf64_Off,
52+
pub e_flags: Elf64_Word,
53+
pub e_ehsize: Elf64_Half,
54+
pub e_phentsize: Elf64_Half,
55+
pub e_phnum: Elf64_Half,
56+
pub e_shentsize: Elf64_Half,
57+
pub e_shnum: Elf64_Half,
58+
pub e_shstrndx: Elf64_Half,
59+
}
60+
61+
pub struct Elf64_Shdr {
62+
pub sh_name: Elf64_Word,
63+
pub sh_type: Elf64_Word,
64+
pub sh_flags: Elf64_Xword,
65+
pub sh_addr: Elf64_Addr,
66+
pub sh_offset: Elf64_Off,
67+
pub sh_size: Elf64_Xword,
68+
pub sh_link: Elf64_Word,
69+
pub sh_info: Elf64_Word,
70+
pub sh_addralign: Elf64_Xword,
71+
pub sh_entsize: Elf64_Xword,
72+
}
73+
74+
pub struct Elf64_Sym {
75+
pub st_name: Elf64_Word,
76+
pub st_info: ::c_uchar,
77+
pub st_other: ::c_uchar,
78+
pub st_shndx: Elf64_Section,
79+
pub st_value: Elf64_Addr,
80+
pub st_size: Elf64_Xword,
81+
}
82+
83+
pub struct Elf64_Phdr {
84+
pub p_type: ::Elf64_Word,
85+
pub p_flags: ::Elf64_Word,
86+
pub p_offset: ::Elf64_Off,
87+
pub p_vaddr: ::Elf64_Addr,
88+
pub p_paddr: ::Elf64_Addr,
89+
pub p_filesz: ::Elf64_Xword,
90+
pub p_memsz: ::Elf64_Xword,
91+
pub p_align: ::Elf64_Xword,
92+
}
93+
}

0 commit comments

Comments
 (0)