From f7c4d796ba67dba27361d07a77eefde05d2e0c9c Mon Sep 17 00:00:00 2001 From: Sergej Jaskiewicz Date: Tue, 10 Mar 2020 18:53:07 +0300 Subject: [PATCH] [compiler-rt] Define ElfW() macro if it's not defined Summary: The `ElfW()` macro is not provided by `` on some systems (e.g., FreeBSD). On these systems the data structures are just called `Elf_XXX`. Define `ElfW()` locally. (This fix is taken from [libunwind](https://github.com/llvm/llvm-project/blob/9b05596eff21388ae6f17cdea8df0538dc630441/libunwind/src/AddressSpace.hpp#L144-L157).) Reviewers: compnerd Differential revision: https://reviews.llvm.org/D75907 --- compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp index edbe840..4d17c96 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp @@ -35,6 +35,10 @@ #include #include +#if !defined(ElfW) +#define ElfW(type) Elf_##type +#endif + #if SANITIZER_FREEBSD #include #include -- 2.7.4