[Lldb-commits] [lldb] r335344 - Android.rules: Use libc++ by default

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 22 06:13:29 PDT 2018


Author: labath
Date: Fri Jun 22 06:13:29 2018
New Revision: 335344

URL: http://llvm.org/viewvc/llvm-project?rev=335344&view=rev
Log:
Android.rules: Use libc++ by default

libstdc++ will soon be dropped from the android NDK. This patch makes
sure we are prepared for that by using libc++ in tests by default (i.e.,
except for libstdc++ data formatter tests).

Only a couple of small tweaks were needed to make this work:
- Add the libc++ include paths to CXXFLAGS only. This was necessary to
  make the tests compile with -fmodules. The modules tests have been
  disabled, but this way, they will be ready for them if they are
  enabled.
- in one test I had to add an explicit std::string copy to make sure the
  copy constructor is there for the expression evaluator to find it.

Modified:
    lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp
    lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
    lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules

Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp?rev=335344&r1=335343&r2=335344&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/auto/main.cpp Fri Jun 22 06:13:29 2018
@@ -12,5 +12,10 @@
 int main()
 {
   std::string helloworld("hello world");
+
+  // Ensure std::string copy constructor is present in the binary, as we will
+  // use it in an expression.
+  std::string other = helloworld;
+
   return 0; // break here
 }

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules?rev=335344&r1=335343&r2=335344&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Android.rules Fri Jun 22 06:13:29 2018
@@ -75,8 +75,15 @@ ARCH_CFLAGS += --sysroot=$(NDK_ROOT)/sys
 	-D__ANDROID_API__=$(API_LEVEL)
 ARCH_LDFLAGS += --sysroot=$(NDK_ROOT)/platforms/android-$(API_LEVEL)/arch-$(SYSROOT_ARCH) -lm
 
-ifeq (1,$(USE_LIBCPP))
+ifeq (1,$(USE_LIBSTDCPP))
 	ARCH_CFLAGS += \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
+		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
+
+	ARCH_LDFLAGS += $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
+else
+	ARCH_CXXFLAGS += \
 		-isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++/include \
 		-isystem $(NDK_ROOT)/sources/android/support/include \
 		-isystem $(NDK_ROOT)/sources/cxx-stl/llvm-libc++abi/include
@@ -84,11 +91,4 @@ ifeq (1,$(USE_LIBCPP))
 	ARCH_LDFLAGS += \
 		-L$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH) \
 		$(NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/$(STL_ARCH)/libc++.a
-else
-	ARCH_CFLAGS += \
-		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include \
-		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/include \
-		-isystem $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include/backward
-
-	ARCH_LDFLAGS += $(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/$(STL_ARCH)/libgnustl_static.a
 endif

Modified: lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules?rev=335344&r1=335343&r2=335344&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/make/Makefile.rules Fri Jun 22 06:13:29 2018
@@ -247,7 +247,7 @@ ifeq "$(MAKE_GMODULES)" "YES"
 	CFLAGS += $(MANDATORY_MODULE_BUILD_CFLAGS)
 endif
 
-CXXFLAGS += -std=c++11 $(CFLAGS)
+CXXFLAGS += -std=c++11 $(CFLAGS) $(ARCH_CXXFLAGS)
 LD = $(CC)
 LDFLAGS ?= $(CFLAGS)
 LDFLAGS += $(LD_EXTRAS) $(ARCH_LDFLAGS)




More information about the lldb-commits mailing list