[PATCH] D75907: [compiler-rt] Define ElfW() macro if it's not defined

Sergej Jaskiewicz via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 10 05:12:14 PDT 2020


broadwaylamb created this revision.
broadwaylamb added reviewers: compnerd, kcc.
Herald added subscribers: llvm-commits, Sanitizers, krytarowski, arichardson, dberris, emaste.
Herald added projects: Sanitizers, LLVM.

The `ElfW()` macro is not provided by `<link.h>` 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>.)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75907

Files:
  compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp


Index: compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
===================================================================
--- compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
+++ compiler-rt/lib/sanitizer_common/sanitizer_linux_libcdep.cpp
@@ -35,6 +35,10 @@
 #include <sys/resource.h>
 #include <syslog.h>
 
+#if !defined(ElfW)
+#define ElfW(type) Elf_##type
+#endif
+
 #if SANITIZER_FREEBSD
 #include <pthread_np.h>
 #include <osreldate.h>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75907.249316.patch
Type: text/x-patch
Size: 468 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200310/3fe750a5/attachment-0001.bin>


More information about the llvm-commits mailing list