From 62d0940d468cb335bdccbde93c291c89426f0da6 Mon Sep 17 00:00:00 2001 From: Jasper Lievisse Adriaanse Date: Sat, 2 Dec 2023 12:00:49 +0100 Subject: [PATCH] Add OpenBSD support (#55) --------- Co-authored-by: 0vercl0k <1476421+0vercl0k@users.noreply.github.com> --- src/rp/elf_struct.hpp | 21 +++++++++++++++++++++ src/rp/platform.h | 4 +++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/rp/elf_struct.hpp b/src/rp/elf_struct.hpp index 8cf0c19..eba5f3a 100644 --- a/src/rp/elf_struct.hpp +++ b/src/rp/elf_struct.hpp @@ -144,11 +144,32 @@ static std::string type_to_str(const uint32_t p_type) { return "PAX_FLAGS"; } + case 0x65a3dbe5: { + return "OPENBSD_MUTABLE"; + } + + case 0x65a3dbe6: { + return "OPENBSD_RANDOMIZE"; + } + + case 0x65a3dbe7: { + return "OPENBSD_WXNEEDED"; + } + + case 0x65a3dbe8: { + return "OPENBSD_NOBTCFI"; + } + + case 0x65a41be6: { + return "OPENBSD_BOOTDATA"; + } + case 0x70000001: { return "SHT_AMD64_UNWIND"; } } + fmt::print("Unknown ELF type 0x{:x}\n", p_type); std::abort(); return "unknown type"; } diff --git a/src/rp/platform.h b/src/rp/platform.h index ae8b032..766c426 100644 --- a/src/rp/platform.h +++ b/src/rp/platform.h @@ -22,7 +22,7 @@ #define WINDOWS_X64 #endif #elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || \ - defined(__FreeBSD_kernel__) || defined(__MACH__) + defined(__FreeBSD_kernel__) || defined(__MACH__) || defined(__OpenBSD__) #define LINUX #if defined(linux) || defined(__linux) @@ -31,6 +31,8 @@ #define SYSTEM_PLATFORM "FreeBSD" #elif defined(__MACH__) #define SYSTEM_PLATFORM "Mac OSX" +#elif defined(__OpenBSD__) +#define SYSTEM_PLATFORM "OpenBSD" #else #error An error occured #endif