Hi danalbert,
We currently only include <link.h> on Linux. We should also make sure to
include it on some of the other systems that support dl_iterate_phdr(). I can
confirm that the code works on FreeBSD and Nuxi CloudABI
(https://github.com/NuxiNL/cloudlibc).
To make the code build on FreeBSD, we need to define ElfW() locally. This macro
is typically only available on Linux.
REPOSITORY
rL LLVM
http://reviews.llvm.org/D8169
Files:
src/Unwind/AddressSpace.hpp
Index: src/Unwind/AddressSpace.hpp
===================================================================
--- src/Unwind/AddressSpace.hpp
+++ src/Unwind/AddressSpace.hpp
@@ -57,9 +57,18 @@
#endif // !defined(_LIBUNWIND_IS_BAREMETAL)
#endif // LIBCXXABI_ARM_EHABI
-#if 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 called Elf{32,64}_XXX. Define ElfW()
+// locally.
+#ifndef ElfW
+#define ElfW(type) ElfW2(__INTPTR_WIDTH__, type)
+#define ElfW2(width, type) ElfW3(width, type)
+#define ElfW3(width, type) Elf##width##_##type
+#endif
#include "EHHeaderParser.hpp"
#endif
#endif
EMAIL PREFERENCES
http://reviews.llvm.org/settings/panel/emailpreferences/
Index: src/Unwind/AddressSpace.hpp
===================================================================
--- src/Unwind/AddressSpace.hpp
+++ src/Unwind/AddressSpace.hpp
@@ -57,9 +57,18 @@
#endif // !defined(_LIBUNWIND_IS_BAREMETAL)
#endif // LIBCXXABI_ARM_EHABI
-#if 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 called Elf{32,64}_XXX. Define ElfW()
+// locally.
+#ifndef ElfW
+#define ElfW(type) ElfW2(__INTPTR_WIDTH__, type)
+#define ElfW2(width, type) ElfW3(width, type)
+#define ElfW3(width, type) Elf##width##_##type
+#endif
#include "EHHeaderParser.hpp"
#endif
#endif
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits