[PATCH] D33131: [compiler-rt][cmake] Build unit tests conditionally with _FILE_OFFSET_BITS=64 and _LARGEFILE_SOURCE

Simon Dardis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 18 06:33:07 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL303350: [compiler-rt][cmake] Build unit tests conditionally with _FILE_OFFSET_BITS=64… (authored by sdardis).

Changed prior to commit:
  https://reviews.llvm.org/D33131?vs=98773&id=99431#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D33131

Files:
  compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt


Index: compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
===================================================================
--- compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
+++ compiler-rt/trunk/lib/sanitizer_common/tests/CMakeLists.txt
@@ -146,6 +146,15 @@
 # Adds sanitizer tests for architecture.
 macro(add_sanitizer_tests_for_arch arch)
   get_target_flags_for_arch(${arch} TARGET_FLAGS)
+
+  # If the sanitizer library was built with _FILE_OFFSET_BITS=64 we need
+  # to ensure that the library and tests agree on the layout of certain
+  # structures such as 'struct stat'.
+  if( CMAKE_SIZEOF_VOID_P EQUAL 4 )
+    list(APPEND TARGET_FLAGS "-D_LARGEFILE_SOURCE")
+    list(APPEND TARGET_FLAGS "-D_FILE_OFFSET_BITS=64")
+  endif()
+
   set(SANITIZER_TEST_SOURCES ${SANITIZER_UNITTESTS}
                              ${COMPILER_RT_GTEST_SOURCE})
   set(SANITIZER_TEST_COMPILE_DEPS ${SANITIZER_TEST_HEADERS})


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33131.99431.patch
Type: text/x-patch
Size: 940 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170518/2c8f049f/attachment.bin>


More information about the llvm-commits mailing list