Index: src/AddressSpace.hpp =================================================================== --- src/AddressSpace.hpp +++ src/AddressSpace.hpp @@ -57,7 +57,7 @@ #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 #include "EHHeaderParser.hpp" @@ -388,8 +388,13 @@ return false; } - for (ElfW(Half) i = 0; i < pinfo->dlpi_phnum; i++) { - const ElfW(Phdr) *phdr = &pinfo->dlpi_phdr[i]; +#ifndef __FreeBSD__ + typedef ElfW(Half) Elf_Half; + typedef ElfW(Phdr) Elf_Phdr; +#endif + + for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) { + const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i]; if (phdr->p_type == PT_LOAD) { uintptr_t begin = pinfo->dlpi_addr + phdr->p_vaddr; uintptr_t end = begin + phdr->p_memsz;