[compiler-rt] r183225 - [sanitizer] Fix windows build.

Kostya Serebryany kcc at google.com
Tue Jun 4 21:25:47 PDT 2013


On Wed, Jun 5, 2013 at 12:07 AM, Richard Smith <richard at metafoo.co.uk>wrote:

> On Tue, Jun 4, 2013 at 7:06 AM, Evgeniy Stepanov <
> eugeni.stepanov at gmail.com> wrote:
>
>> Author: eugenis
>> Date: Tue Jun  4 09:06:16 2013
>> New Revision: 183225
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=183225&view=rev
>> Log:
>> [sanitizer] Fix windows build.
>>
>> Modified:
>>     compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>>
>> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>> URL:
>> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h?rev=183225&r1=183224&r2=183225&view=diff
>>
>> ==============================================================================
>> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h
>> (original)
>> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_internal_defs.h Tue
>> Jun  4 09:06:16 2013
>> @@ -68,14 +68,6 @@ typedef signed   int s32;
>>  typedef signed   long long s64;  // NOLINT
>>  typedef int fd_t;
>>
>> -// Unaligned versions.
>> -typedef __attribute__((aligned(1))) u16 uu16;
>> -typedef __attribute__((aligned(1))) u32 uu32;
>> -typedef __attribute__((aligned(1))) u64 uu64;
>> -typedef __attribute__((aligned(1))) s16 us16;
>> -typedef __attribute__((aligned(1))) s32 us32;
>> -typedef __attribute__((aligned(1))) s64 us64;
>> -
>>  // WARNING: OFF_T may be different from OS type off_t, depending on the
>> value of
>>  // _FILE_OFFSET_BITS. This definition of OFF_T matches the ABI of system
>> calls
>>  // like pread and mmap, as opposed to pread64 and mmap64.
>> @@ -160,6 +152,14 @@ using namespace __sanitizer;  // NOLINT
>>  # endif
>>  #endif  // _MSC_VER
>>
>> +// Unaligned versions of basic types.
>> +typedef ALIGNED(1) u16 uu16;
>> +typedef ALIGNED(1) u32 uu32;
>> +typedef ALIGNED(1) u64 uu64;
>> +typedef ALIGNED(1) s16 us16;
>> +typedef ALIGNED(1) s32 us32;
>> +typedef ALIGNED(1) s64 us64;
>
>
> We have a fair amount of experience showing that usage of alignment
> attributes is very subtle and prone to portability issues. Can you use
> memcpy instead?
>

This part is actually performance critical.
We had at least one piece of code where we initially used memcpy, but had
to revert to __sanitizer_unaligned_load (which uses a simple load) to
recover part of performance.


--kcc


>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130605/af464824/attachment.html>


More information about the llvm-commits mailing list