Skip to content

Commit a32cb4a

Browse files
committed
compiler-rt: Undef _TIME_BITS along with _FILE_OFFSET_BITS in sanitizers
On 32bit systems using 64bit time_t build fails because _FILE_OFFSET_BITS is undefined here but _TIME_BITS is still set to 64 Fixes In file included from compiler-rt/lib/sanitizer_common/sanitizer_procmaps_solaris.cpp:17: In file included from compiler-rt/lib/sanitizer_common/sanitizer_platform.h:25: In file included from /usr/include/features.h:393: /usr/include/features-time64.h:26:5: error: "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" ^ 1 error generated. Upstream-Status: Submitted [https://reviews.llvm.org/D144514] Signed-off-by: Khem Raj <[email protected]>
1 parent 31aa880 commit a32cb4a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler-rt/lib/sanitizer_common/sanitizer_platform.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,15 @@
2222
// function declarations into a .S file which doesn't compile.
2323
// https://crbug.com/1162741
2424
#if __has_include(<features.h>) && !defined(__ANDROID__)
25+
// Some sources undefine _FILE_OFFSET_BITS deliberately e.g.
26+
// sanitizer_procmaps_solaris.cpp. This is problematic on glibc systems with
27+
// 32-bit architectures using 64-bit time_t and users passing _TIME_BITS=64
28+
// from build environment, therefore both _FILE_OFFSET_BITS and _TIME_BITS
29+
// need to be undefined together since features.h will check for both being 64
30+
// if one is set to 64.
31+
# if !defined(_FILE_OFFSET_BITS)
32+
# undef _TIME_BITS
33+
# endif
2534
# include <features.h>
2635
#endif
2736

0 commit comments

Comments
 (0)