[Lldb-commits] [PATCH] D32125: [LLVM][MIPS] Fix different definition of off_t in LLDB and LLVM

Nitesh Jain via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 17 06:26:00 PDT 2017


nitesh.jain created this revision.
Herald added subscribers: arichardson, mgorny.

Fix is to define _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64. This fix will cause llvm::sys::fs::file_size() to return correct object size.


Repository:
  rL LLVM

https://reviews.llvm.org/D32125

Files:
  CMakeLists.txt


Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -458,6 +458,12 @@
   option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
 endif()
 
+# If building on a 32-bit system, make sure off_t can store offsets > 2GB
+if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
+  add_definitions( -D_LARGEFILE_SOURCE )
+  add_definitions( -D_FILE_OFFSET_BITS=64 )
+endif()
+
 # Define the default arguments to use with 'lit', and an option for the user to
 # override.
 set(LIT_ARGS_DEFAULT "-sv")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D32125.95435.patch
Type: text/x-patch
Size: 568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20170417/336b55b8/attachment.bin>


More information about the lldb-commits mailing list