[Compiler-rt][PATCH] Fix MSVC compilation of lib/profile/InstrProfData.inc

Johan Engelen via llvm-commits llvm-commits at lists.llvm.org
Sat Dec 19 10:27:45 PST 2015


Hi all,
  Here is another patch to fix building compiler-rt/lib/profile with MSVC.

MSVC does not do pointer math on void* (InstrProfilingPlatformOther.c lines
37 and 39), and so the types of NamePtr and CounterPtr should be mentioned
explicitly.
Is there a reason why "IntPtrT" was used instead of specifying the types as
is done in this patch? The LLVM calls (getInt8PtrTy) also explicitly
contain the type size.

With this patch, trunk works with MSVC, with these two remaining issues:
1. GCDAProfiling.c does not compile, because it includes <sys/mman.h> and
<sys/file.h> that are not available with MSVC.
2. COMPILER_RT_HAS_ATOMICS should not be 1 for MSVC. Unfortunately, MSVC
does not have a drop-in replacement for GCC's __sync_bool_compare_and_swap,
and so a fix is non-trivial.

Thanks,
  Johan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151219/19915ff4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fixMSVCbuild_InstrProfData.inc.patch
Type: application/octet-stream
Size: 996 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151219/19915ff4/attachment.obj>


More information about the llvm-commits mailing list