[compiler-rt] r353139 - gn build: Upgrade to NDK r19.

Peter Collingbourne via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 4 21:10:19 PST 2019


Author: pcc
Date: Mon Feb  4 21:10:19 2019
New Revision: 353139

URL: http://llvm.org/viewvc/llvm-project?rev=353139&view=rev
Log:
gn build: Upgrade to NDK r19.

NDK r19 includes a sysroot that can be used directly by the compiler
without creating a standalone toolchain, so we just need a handful
of flags to point Clang there.

Differential Revision: https://reviews.llvm.org/D57733

Modified:
    compiler-rt/trunk/CMakeLists.txt
    compiler-rt/trunk/test/hwasan/TestCases/sizes.cpp
    compiler-rt/trunk/test/lit.common.cfg
    compiler-rt/trunk/test/lit.common.configured.in

Modified: compiler-rt/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/CMakeLists.txt?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- compiler-rt/trunk/CMakeLists.txt (original)
+++ compiler-rt/trunk/CMakeLists.txt Mon Feb  4 21:10:19 2019
@@ -157,6 +157,9 @@ if ("${COMPILER_RT_DEFAULT_TARGET_TRIPLE
 endif()
 pythonize_bool(ANDROID)
 
+set(ANDROID_NDK_VERSION 18
+    CACHE STRING "Set this to the Android NDK version that you are using")
+
 set(COMPILER_RT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
 set(COMPILER_RT_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
 

Modified: compiler-rt/trunk/test/hwasan/TestCases/sizes.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/hwasan/TestCases/sizes.cpp?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- compiler-rt/trunk/test/hwasan/TestCases/sizes.cpp (original)
+++ compiler-rt/trunk/test/hwasan/TestCases/sizes.cpp Mon Feb  4 21:10:19 2019
@@ -1,4 +1,6 @@
-// RUN: %clangxx_hwasan %s -lstdc++ -o %t
+// This test requires operator new to be intercepted by the hwasan runtime,
+// so we need to avoid linking against libc++.
+// RUN: %clangxx_hwasan %s -nostdlib++ -lstdc++ -o %t
 // RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t malloc 2>&1          | FileCheck %s --check-prefix=CHECK-max
 // RUN: %env_hwasan_opts=allocator_may_return_null=1     %run %t malloc 2>&1
 // RUN: %env_hwasan_opts=allocator_may_return_null=0 not %run %t malloc max 2>&1      | FileCheck %s --check-prefix=CHECK-max

Modified: compiler-rt/trunk/test/lit.common.cfg
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.cfg?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.cfg (original)
+++ compiler-rt/trunk/test/lit.common.cfg Mon Feb  4 21:10:19 2019
@@ -60,7 +60,12 @@ if config.asan_shadow_scale != '':
 if config.android:
   # Prepend the flag so that it can be overridden.
   config.target_cflags = "-pie -fuse-ld=gold " + config.target_cflags
-  config.cxx_mode_flags.append('-stdlib=libstdc++')
+  if config.android_ndk_version < 19:
+    # With a new compiler and NDK < r19 this flag ends up meaning "link against
+    # libc++", but NDK r19 makes this mean "link against the stub libstdc++ that
+    # just contains a handful of ABI functions", which makes most C++ code fail
+    # to link. In r19 and later we just use the default which is libc++.
+    config.cxx_mode_flags.append('-stdlib=libstdc++')
 
 # Clear some environment variables that might affect Clang.
 possibly_dangerous_env_vars = ['ASAN_OPTIONS', 'DFSAN_OPTIONS', 'LSAN_OPTIONS',

Modified: compiler-rt/trunk/test/lit.common.configured.in
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/test/lit.common.configured.in?rev=353139&r1=353138&r2=353139&view=diff
==============================================================================
--- compiler-rt/trunk/test/lit.common.configured.in (original)
+++ compiler-rt/trunk/test/lit.common.configured.in Mon Feb  4 21:10:19 2019
@@ -36,6 +36,7 @@ set_default("use_thinlto", False)
 set_default("use_lto", config.use_thinlto)
 set_default("use_newpm", False)
 set_default("android", @ANDROID_PYBOOL@)
+set_default("android_ndk_version", @ANDROID_NDK_VERSION@)
 set_default("android_serial", "@ANDROID_SERIAL_FOR_TESTING@")
 set_default("android_files_to_push", [])
 set_default("have_rpc_xdr_h", @HAVE_RPC_XDR_H@)




More information about the llvm-commits mailing list