From 480e924daedee520d18c8a9c0b9823fef205b57a Mon Sep 17 00:00:00 2001 From: David Coppa Date: Fri, 21 Jun 2013 11:13:35 +0200 Subject: OpenBSD: Enable ELF parsing and editing (#14241) OpenBSD provides ELF ABI declarations in #include #include Teach the platform check and cmELF implementation to use these. --- Source/CMakeLists.txt | 6 +++++- Source/cmELF.cxx | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 1893167..67a6333 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -11,7 +11,11 @@ #============================================================================= include(CheckIncludeFile) # Check if we can build support for ELF parsing. -CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H) +if(CMAKE_CXX_PLATFORM_ID MATCHES "OpenBSD") + CHECK_INCLUDE_FILES("stdint.h;elf_abi.h" HAVE_ELF_H) +else() + CHECK_INCLUDE_FILE("elf.h" HAVE_ELF_H) +endif() if(HAVE_ELF_H) set(CMAKE_USE_ELF_PARSER 1) else() diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index 1158fc0..30de9a8 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -19,7 +19,12 @@ #include // Include the ELF format information system header. -#include +#if defined(__OpenBSD__) +# include +# include +#else +# include +#endif #if defined(__sun) # include // For dynamic section information #endif -- cgit v0.12