140-sanitizer-Fix-build-with-_FILE_OFFSET_BITS-64.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. From 3c536954a67a883630f4a7513a27f02a892c3dcb Mon Sep 17 00:00:00 2001
  2. From: Evgeniy Stepanov <eugeni.stepanov@gmail.com>
  3. Date: Tue, 21 Oct 2014 21:08:13 +0000
  4. Subject: [PATCH] [sanitizer] Fix build with _FILE_OFFSET_BITS=64.
  5. Sanitizer source is not affected by _FILE_OFFSET_BITS in general,
  6. but this one file must be built with 32-bit off_t. More details in the code.
  7. git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@220328 91177308-0d34-0410-b5e6-96231b3b80d8
  8. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
  9. ---
  10. lib/sanitizer_common/sanitizer_platform_limits_posix.cc | 8 ++++++++
  11. 1 file changed, 8 insertions(+)
  12. diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
  13. index bbc1108..fc09522 100644
  14. --- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
  15. +++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cc
  16. @@ -13,7 +13,15 @@
  17. #include "sanitizer_platform.h"
  18. #if SANITIZER_LINUX || SANITIZER_MAC
  19. +// Tests in this file assume that off_t-dependent data structures match the
  20. +// libc ABI. For example, struct dirent here is what readdir() function (as
  21. +// exported from libc) returns, and not the user-facing "dirent", which
  22. +// depends on _FILE_OFFSET_BITS setting.
  23. +// To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS below.
  24. +#ifdef _FILE_OFFSET_BITS
  25. +#undef _FILE_OFFSET_BITS
  26. +#endif
  27. #include "sanitizer_internal_defs.h"
  28. #include "sanitizer_platform_limits_posix.h"
  29. --
  30. 2.1.4