OpenBSD: Enable ELF parsing and editing (#14241)

OpenBSD provides ELF ABI declarations in

 #include <stdint.h>
 #include <elf_abi.h>

Teach the platform check and cmELF implementation to use these.
This commit is contained in:
David Coppa 2013-06-21 11:13:35 +02:00 committed by Brad King
parent 9f160c5b0a
commit 480e924dae
2 changed files with 11 additions and 2 deletions

View File

@ -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()

View File

@ -19,7 +19,12 @@
#include <cmsys/CPU.h>
// Include the ELF format information system header.
#include <elf.h>
#if defined(__OpenBSD__)
# include <stdint.h>
# include <elf_abi.h>
#else
# include <elf.h>
#endif
#if defined(__sun)
# include <sys/link.h> // For dynamic section information
#endif