Skip to content

Commit 920de81

Browse files
committed
[sanitizer] Undef _TIME_BITS along with _FILE_OFFSET_BITS
This change is identical to 26800a2 ("[sanitizer] Undef _TIME_BITS along with _FILE_OFFSET_BITS on Linux"), but for sanitizer_procmaps_solaris.cpp. Indeed, even though sanitizer_procmaps_solaris.cpp is Solaris specific, it also gets built on Linux platforms. It also includes sanitizer_platform.h, which also ends up including features-time64.h, causing a build failure on 32-bit Linux platforms on which 64-bit time_t is enabled by setting _TIME_BITS=64. To fix this, we do the same change: undefine _TIME_BITS, which anyway will cause no harm as the rest of this file is inside a SANITIZER_SOLARIS compile-time conditional. Fixes: In file included from /home/thomas/buildroot/buildroot/output/host/i686-buildroot-linux-gnu/sysroot/usr/include/features.h:394, from ../../../../libsanitizer/sanitizer_common/sanitizer_platform.h:25, from ../../../../libsanitizer/sanitizer_common/sanitizer_procmaps_solaris.cpp:14: /home/thomas/buildroot/buildroot/output/host/i686-buildroot-linux-gnu/sysroot/usr/include/features-time64.h:26:5: error: #error "_TIME_BITS=64 is al lowed only with _FILE_OFFSET_BITS=64" 26 | # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" | ^~~~~ Signed-off-by: Thomas Petazzoni <[email protected]>
1 parent 9b02b75 commit 920de81

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_procmaps_solaris.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,18 @@
1111

1212
// Before Solaris 11.4, <procfs.h> doesn't work in a largefile environment.
1313
#undef _FILE_OFFSET_BITS
14+
15+
// Even though this is a Solaris-specific file, it gets built on all
16+
// platforms, including Linux ones. On such platforms, _TIME_BITS=64
17+
// might be passed to enable 64-bit time_t on 32-bit
18+
// architectures. However _TIME_BITS=64 requires _FILE_OFFSET_BITS=64,
19+
// but we undefine _FILE_OFFSET_BITS above, causing a failure as
20+
// sanitizer_platform.h below includes some system headers that are
21+
// unhappy with _TIME_BITS defined and _FILE_OFFSET_BITS
22+
// undefined. Therefore, apply the same consideration as in
23+
// sanitizer_platform_limits_posix.cpp, which consists in undefining
24+
// _TIME_BITS.
25+
#undef _TIME_BITS
1426
#include "sanitizer_platform.h"
1527
#if SANITIZER_SOLARIS
1628
# include <fcntl.h>

0 commit comments

Comments
 (0)