[patch] fix libsanitizer build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 on 32bit architectures

Matthias Klose doko@debian.org
Thu Feb 22 19:48:43 GMT 2024


libsanitizer fails to build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64, 
triggering an #error in /usr/include/features-time64.h

--- a/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp
@@ -11,6 +11,7 @@

  // Before Solaris 11.4, <procfs.h> doesn't work in a largefile 
environment.
  #undef _FILE_OFFSET_BITS
+#undef _TIME_BITS
  #include "sanitizer_platform.h"
  #if SANITIZER_SOLARIS
  #  include <fcntl.h>
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -18,6 +18,7 @@
  // depends on _FILE_OFFSET_BITS setting.
  // To get this "true" dirent definition, we undefine _FILE_OFFSET_BITS 
below.
  #undef _FILE_OFFSET_BITS
+#undef _TIME_BITS
  #endif

  // Must go after undef _FILE_OFFSET_BITS.


The patch to sanitizer_platform_limits_posix.cpp is already present in 
trunk, but missing from the branches.

Because all platform files are built in GCC, you also see the failure in 
sanitizer_procmaps_solaris.cpp. Just doing the same as for the posix 
files fixes the issue and libsanitizer builds again.

Does this have any effect on the solaris builds?  If not, ok for the 
trunk and the branches?

Matthias


More information about the Gcc-patches mailing list