Make the .eh_frame_hdr code work on FreeBSD as well.

We currently only include <link.h> on CloudABI and Linux. We can enable
it on FreeBSD as well, as it also supports the dl_iterate_phdr()
function that's provided by <link.h>.

FreeBSD, however, does not provide the ElfW() macro. Instead, the
host-specific ELF datastructures are named just Elf_XXX in addition to
the host-independent Elf32_XXX and Elf64_XXX types.

Differential Revision:	http://reviews.llvm.org/D8169
Approved by:	emaste

llvm-svn: 236154
This commit is contained in:
Ed Schouten 2015-04-29 20:43:44 +00:00
parent 8c7829b82f
commit 8fd97a3ade
1 changed files with 8 additions and 1 deletions

View File

@ -57,9 +57,16 @@ extern EHTEntry __exidx_end;
#endif // !defined(_LIBUNWIND_IS_BAREMETAL)
#endif // LIBCXXABI_ARM_EHABI
#if defined(__CloudABI__) || defined(__linux__)
#if defined(__CloudABI__) || defined(__FreeBSD__) || defined(__linux__)
#if _LIBUNWIND_SUPPORT_DWARF_UNWIND && _LIBUNWIND_SUPPORT_DWARF_INDEX
#include <link.h>
// Macro for machine-independent access to the ELF program headers. This
// macro is not available on some systems (e.g., FreeBSD). On these
// systems the data structures are just called Elf_XXX. Define ElfW()
// locally.
#if !defined(ElfW)
#define ElfW(type) Elf_##type
#endif
#include "EHHeaderParser.hpp"
#endif
#endif