diff mbox series

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

Message ID b56ef43a-4e02-4503-b775-ec67ddfea616@debian.org
State New
Headers show
Series fix libsanitizer build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64 on 32bit architectures | expand

Commit Message

Matthias Klose Feb. 22, 2024, 7:48 p.m. UTC
libsanitizer fails to build with -D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64, 
triggering an #error in /usr/include/features-time64.h

  // 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

Comments

Rainer Orth Feb. 22, 2024, 8:29 p.m. UTC | #1
Hi Matthias,

> 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?

Since _TIME_BITS isn't used in Solaris system headers at all, there's no
impact.

However, the sanitizer_procmaps_solaris.cpp change needs to go into
upstream LLVM first and can only then be cherry-picked into libsanitizer
once it has been committed there.

	Rainer
diff mbox series

Patch

--- 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