[PATCH] D64483: [CMake] Define _FILE_OFFSET_BITS=64 on Solaris

Rainer Orth via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 06:37:10 PDT 2019


ro created this revision.
ro added reviewers: fedor.sergeev, chandlerc.
Herald added a subscriber: mgorny.
Herald added a project: LLVM.

This is the compantion patch to https://reviews.llvm.org/D64482, needed to ensure
that builds with host compilers that don't yet predefine `_FILE_OFFSET_BITS=64` on
Solaris succeed by always making the host and freshly built clang consistent.

Tested on `x86_64-pc-solaris2.11`.  Ok for trunk?


Repository:
  rL LLVM

https://reviews.llvm.org/D64483

Files:
  CMakeLists.txt
  cmake/config-ix.cmake


Index: cmake/config-ix.cmake
===================================================================
--- cmake/config-ix.cmake
+++ cmake/config-ix.cmake
@@ -30,6 +30,12 @@
           list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_LARGE_FILE_API")
 endif()
 
+# Do checks with _FILE_OFFSET_BITS=64 on Solaris, because we will build
+# with those too.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+          list(APPEND CMAKE_REQUIRED_DEFINITIONS "-D_FILE_OFFSET_BITS=64")
+endif()
+
 # include checks
 check_include_file(dlfcn.h HAVE_DLFCN_H)
 check_include_file(errno.h HAVE_ERRNO_H)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -832,6 +832,11 @@
           add_definitions("-D_LARGE_FILE_API")
 endif()
 
+# Build with _FILE_OFFSET_BITS=64 on Solaris to match g++ >= 9.
+if (UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
+          add_definitions("-D_FILE_OFFSET_BITS=64")
+endif()
+
 # Work around a broken bfd ld behavior. When linking a binary with a
 # foo.so library, it will try to find any library that foo.so uses and
 # check its symbols. This is wasteful (the check was done when foo.so


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64483.208938.patch
Type: text/x-patch
Size: 1185 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190710/d6c65dd7/attachment.bin>


More information about the llvm-commits mailing list