[compiler-rt] r220328 - [sanitizer] Fix build with _FILE_OFFSET_BITS=64.

Evgeniy Stepanov eugeni.stepanov at gmail.com
Tue Oct 21 14:08:13 PDT 2014


Author: eugenis
Date: Tue Oct 21 16:08:13 2014
New Revision: 220328

URL: http://llvm.org/viewvc/llvm-project?rev=220328&view=rev
Log:
[sanitizer] Fix build with _FILE_OFFSET_BITS=64.

Sanitizer source is not affected by _FILE_OFFSET_BITS in general,
but this one file must be built with 32-bit off_t. More details in the code.


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=220328&r1=220327&r2=220328&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 Tue Oct 21 16:08:13 2014
@@ -15,6 +15,14 @@
 
 #include "sanitizer_platform.h"
 #if SANITIZER_LINUX || SANITIZER_FREEBSD || SANITIZER_MAC
+// Tests in this file assume that off_t-dependent data structures match the
+// libc ABI. For example, struct dirent here is what readdir() function (as
+// exported from libc) returns, and not the user-facing "dirent", which
+// depends on _FILE_OFFSET_BITS setting.
+// To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS below.
+#ifdef _FILE_OFFSET_BITS
+#undef _FILE_OFFSET_BITS
+#endif
 #if SANITIZER_FREEBSD
 #define _WANT_RTENTRY
 #include <sys/param.h>





More information about the llvm-commits mailing list