[compiler-rt] r321817 - [asan] Fix build with Android NDK < 14.

Evgeniy Stepanov via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 4 11:47:55 PST 2018


Author: eugenis
Date: Thu Jan  4 11:47:55 2018
New Revision: 321817

URL: http://llvm.org/viewvc/llvm-project?rev=321817&view=rev
Log:
[asan] Fix build with Android NDK < 14.

NDK < 13 & API_LEVEL < 21 do not define struct mmsghdr.
Newer NDK use unified headers and provide this definition for all api
levels.

Since we can not check for the NDK version, check the api level. This
is more strict than absolutely necessary, but it does not really
matter: it is only a sanity check.

Modified:
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc?rev=321817&r1=321816&r2=321817&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_platform_limits_posix.cc Thu Jan  4 11:47:55 2018
@@ -1026,7 +1026,7 @@ CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_len)
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_level);
 CHECK_SIZE_AND_OFFSET(cmsghdr, cmsg_type);
 
-#if SANITIZER_LINUX
+#if SANITIZER_LINUX && (!defined(__ANDROID__) || __ANDROID_API__ >= 21)
 CHECK_TYPE_SIZE(mmsghdr);
 CHECK_SIZE_AND_OFFSET(mmsghdr, msg_hdr);
 CHECK_SIZE_AND_OFFSET(mmsghdr, msg_len);




More information about the llvm-commits mailing list