0005-libsanitizer-also-undef-_TIME_BITS-in-sanitizer_proc.patch 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. From 7ad54084a2c07cca6d03dfe274893e903852d359 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  3. Date: Thu, 18 Jul 2024 23:13:41 +0200
  4. Subject: [PATCH] libsanitizer: also undef _TIME_BITS in
  5. sanitizer_procmaps_solaris.cpp
  6. Upstream commit
  7. https://github.com/llvm/llvm-project/commit/26800a2c7e7996dc773b4e990dd5cca41c45e1a9
  8. of LLVM added a #undef _TIME_BITS in
  9. libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp to
  10. fix the build on 32-bit Linux platforms that have enabled 64-bit
  11. time_t using _TIME_BITS=64.
  12. Indeed, _TIME_BITS=64 can only be used when _FILE_OFFSET_BITS=64, but
  13. sanitizer_platform_limits_posix.cpp undefines _FILE_OFFSET_BITS before
  14. including any header file. To fix this, the upstream fix was to also
  15. undef _TIME_BITS.
  16. This commit simply does the same in sanitizer_procmaps_solaris.cpp,
  17. which also gets compiled under Linux (despite what the file name
  18. says). In practice on Linux hosts (where _TIME_BITS=64 matters),
  19. sanitizer_procmaps_solaris.cpp will expand to nothing, as pretty much
  20. the rest of the file is inside a #ifdef SANITIZER_SOLARIS...#endif. So
  21. the #undef _FILE_OFFSET_BITS and #undef _TIME_BITS are only here
  22. before including sanitizer_platform.h, which will set the
  23. SANITIZER_LINUX/SANITIZER_SOLARIS define depending on the platform.
  24. Fixes:
  25. armeb-buildroot-linux-gnueabi/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
  26. 26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64"
  27. Upstream: https://gcc.gnu.org/pipermail/gcc-patches/2024-July/657811.html
  28. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  29. ---
  30. libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp | 1 +
  31. 1 file changed, 1 insertion(+)
  32. diff --git a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
  33. index eeb49e2afe3..1b23fd4d512 100644
  34. --- a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
  35. +++ b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
  36. @@ -11,6 +11,7 @@
  37. // Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
  38. #undef _FILE_OFFSET_BITS
  39. +#undef _TIME_BITS
  40. #include "sanitizer_platform.h"
  41. #if SANITIZER_SOLARIS
  42. # include <fcntl.h>
  43. --
  44. 2.45.2