[PATCH] libc++abi: Make the .eh_frame_hdr code work on FreeBSD and CloudABI as well
Ed Schouten
ed at nuxi.nl
Mon Mar 9 06:59:19 PDT 2015
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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8169.21487.patch
Type: text/x-patch
Size: 895 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150309/48535e1d/attachment.bin>
More information about the cfe-commits
mailing list