Fix Linux i386 build
- missing definitions were causing different definitions of type 'off_t', resulting in linker errors
- fix is to define _LARGEFILE_SOURCE and _FILE_OFFSET_BITS=64



git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@176595 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f144fe2..d5a28ea 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,14 @@
   )

 endif() 

 

+# If building on a 32-bit system, make sure off_t can store offsets > 2GB

+if( CMAKE_SIZEOF_VOID_P EQUAL 4 )

+  add_lldb_definitions(

+    -D_LARGEFILE_SOURCE

+    -D_FILE_OFFSET_BITS=64

+    )

+endif()

+

 set(LLDB_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})

 set(LLDB_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})

 

diff --git a/Makefile b/Makefile
index 890a7a9..a26ef91 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,11 @@
 CPP.Flags += -DLLDB_VENDOR='"$(LLDB_VENDOR) "'
 endif
 
+# If building on a 32-bit system, make sure off_t can store offsets > 2GB
+ifneq "$(HOST_ARCH)" "x86_64"
+CPP.Flags += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
+endif
+
 # Disable -fstrict-aliasing. Darwin disables it by default (and LLVM doesn't
 # work with it enabled with GCC), Clang/llvm-gc don't support it yet, and newer
 # GCC's have false positive warnings with it on Linux (which prove a pain to