[llvm] f31a36e - Revert D139752 "cmake: Enable 64bit off_t on 32bit glibc systems"
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 20 09:45:32 PST 2022
Author: Fangrui Song
Date: 2022-12-20T09:45:28-08:00
New Revision: f31a36e7767ea98c5c9cce8c2e9a09dda9899e85
URL: https://github.com/llvm/llvm-project/commit/f31a36e7767ea98c5c9cce8c2e9a09dda9899e85
DIFF: https://github.com/llvm/llvm-project/commit/f31a36e7767ea98c5c9cce8c2e9a09dda9899e85.diff
LOG: Revert D139752 "cmake: Enable 64bit off_t on 32bit glibc systems"
This reverts commit ae3e228af77fea9ff4c45cca88a7a0de2cad662b.
Seems that it may form a wrong command line for 32-bit Halide builds
`-D_FILE_OFFSET_BITS="64 -D_DEBUG -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DSTDC_CONSTANT_MACROS -DSTDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS"` according to
Added:
Modified:
llvm/cmake/config-ix.cmake
llvm/include/llvm/Config/config.h.cmake
llvm/lib/Support/raw_ostream.cpp
Removed:
################################################################################
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 3c63082dd2b0b..f58f3b13a0803 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -284,6 +284,9 @@ check_symbol_exists(futimes sys/time.h HAVE_FUTIMES)
if( HAVE_SIGNAL_H AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*" AND NOT APPLE )
check_symbol_exists(sigaltstack signal.h HAVE_SIGALTSTACK)
endif()
+set(CMAKE_REQUIRED_DEFINITIONS "-D_LARGEFILE64_SOURCE")
+check_symbol_exists(lseek64 "sys/types.h;unistd.h" HAVE_LSEEK64)
+set(CMAKE_REQUIRED_DEFINITIONS "")
check_symbol_exists(mallctl malloc_np.h HAVE_MALLCTL)
check_symbol_exists(mallinfo malloc.h HAVE_MALLINFO)
check_symbol_exists(mallinfo2 malloc.h HAVE_MALLINFO2)
@@ -337,11 +340,6 @@ check_symbol_exists(__GLIBC__ stdio.h LLVM_USING_GLIBC)
if( LLVM_USING_GLIBC )
add_compile_definitions(_GNU_SOURCE)
list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_GNU_SOURCE")
-# enable 64bit off_t on 32bit systems using glibc
- if (CMAKE_SIZEOF_VOID_P EQUAL 4)
- add_compile_definitions(_FILE_OFFSET_BITS=64)
- list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
- endif()
endif()
# This check requires _GNU_SOURCE.
diff --git a/llvm/include/llvm/Config/config.h.cmake b/llvm/include/llvm/Config/config.h.cmake
index 29ac536b4c31b..3543e6fc29944 100644
--- a/llvm/include/llvm/Config/config.h.cmake
+++ b/llvm/include/llvm/Config/config.h.cmake
@@ -128,6 +128,9 @@
/* Define to 1 if you have the <link.h> header file. */
#cmakedefine HAVE_LINK_H ${HAVE_LINK_H}
+/* Define to 1 if you have the `lseek64' function. */
+#cmakedefine HAVE_LSEEK64 ${HAVE_LSEEK64}
+
/* Define to 1 if you have the <mach/mach.h> header file. */
#cmakedefine HAVE_MACH_MACH_H ${HAVE_MACH_MACH_H}
diff --git a/llvm/lib/Support/raw_ostream.cpp b/llvm/lib/Support/raw_ostream.cpp
index 8943c4478c7f2..92b15f14c62fd 100644
--- a/llvm/lib/Support/raw_ostream.cpp
+++ b/llvm/lib/Support/raw_ostream.cpp
@@ -802,6 +802,8 @@ uint64_t raw_fd_ostream::seek(uint64_t off) {
flush();
#ifdef _WIN32
pos = ::_lseeki64(FD, off, SEEK_SET);
+#elif defined(HAVE_LSEEK64)
+ pos = ::lseek64(FD, off, SEEK_SET);
#else
pos = ::lseek(FD, off, SEEK_SET);
#endif
More information about the llvm-commits
mailing list