Skip to content

Commit 4178dec

Browse files
committed
Auto merge of #3409 - ltratt:exec_elf, r=JohnTitor
Add various constants from OpenBSD's sys/exec_elf.h. This mirrors more of the constants that, for example, are available in linux/mod.rs. These values are taken from https://github.com/openbsd/src/blob/master/sys/sys/exec_elf.h, though, unsurprisingly, they match those on Linux's `elf.h` (occasionally with different formatting, which I have preserved in this PR).
2 parents 5e32df0 + 35737af commit 4178dec

File tree

1 file changed

+24
-0
lines changed
  • src/unix/bsd/netbsdlike/openbsd

1 file changed

+24
-0
lines changed

src/unix/bsd/netbsdlike/openbsd/mod.rs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,6 +1731,30 @@ pub const SF_ARCHIVED: ::c_uint = 0x00010000;
17311731
pub const SF_IMMUTABLE: ::c_uint = 0x00020000;
17321732
pub const SF_APPEND: ::c_uint = 0x00040000;
17331733

1734+
// sys/exec_elf.h - Legal values for p_type (segment type).
1735+
pub const PT_NULL: u32 = 0;
1736+
pub const PT_LOAD: u32 = 1;
1737+
pub const PT_DYNAMIC: u32 = 2;
1738+
pub const PT_INTERP: u32 = 3;
1739+
pub const PT_NOTE: u32 = 4;
1740+
pub const PT_SHLIB: u32 = 5;
1741+
pub const PT_PHDR: u32 = 6;
1742+
pub const PT_TLS: u32 = 7;
1743+
pub const PT_LOOS: u32 = 0x60000000;
1744+
pub const PT_HIOS: u32 = 0x6fffffff;
1745+
pub const PT_LOPROC: u32 = 0x70000000;
1746+
pub const PT_HIPROC: u32 = 0x7fffffff;
1747+
1748+
pub const PT_GNU_EH_FRAME: u32 = 0x6474e550;
1749+
pub const PT_GNU_RELRO: u32 = 0x6474e552;
1750+
1751+
// sys/exec_elf.h - Legal values for p_flags (segment flags).
1752+
pub const PF_X: u32 = 0x1;
1753+
pub const PF_W: u32 = 0x2;
1754+
pub const PF_R: u32 = 0x4;
1755+
pub const PF_MASKOS: u32 = 0x0ff00000;
1756+
pub const PF_MASKPROC: u32 = 0xf0000000;
1757+
17341758
// sys/mount.h
17351759
pub const MNT_NOPERM: ::c_int = 0x00000020;
17361760
pub const MNT_WXALLOWED: ::c_int = 0x00000800;

0 commit comments

Comments
 (0)