[PATCH] D107388: Work around non-existence of ElfW(type) macro on FreeBSD
Dimitry Andric via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 3 12:36:37 PDT 2021
dim created this revision.
dim added reviewers: emaste, gulfem, davidxl, phosek.
Herald added subscribers: krytarowski, arichardson.
dim requested review of this revision.
Herald added a project: Sanitizers.
Herald added a subscriber: Sanitizers.
Fixes PR51331. On FreeBSD, the elf headers don't (yet) provide the
ElfW(type) macro. However, there is a similar set of macros in the
<sys/elf-generic.h> header, of which `__ElfN(type)` exactly matches the
indended purpose.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D107388
Files:
compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
Index: compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
===================================================================
--- compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
+++ compiler-rt/lib/profile/InstrProfilingPlatformLinux.c
@@ -17,6 +17,10 @@
#include "InstrProfiling.h"
#include "InstrProfilingInternal.h"
+#if defined(__FreeBSD__) && !defined(ElfW)
+#define ElfW(type) __ElfN(type)
+#endif
+
#define PROF_DATA_START INSTR_PROF_SECT_START(INSTR_PROF_DATA_COMMON)
#define PROF_DATA_STOP INSTR_PROF_SECT_STOP(INSTR_PROF_DATA_COMMON)
#define PROF_NAME_START INSTR_PROF_SECT_START(INSTR_PROF_NAME_COMMON)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107388.363837.patch
Type: text/x-patch
Size: 630 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210803/2f6e92b1/attachment.bin>
More information about the llvm-commits
mailing list