This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] Fix libstdc++ build for Android


Hi,

libstdc++-v3 already contains support but doesn't build for Android.  Now GDB 
has switched to C++, which means that you need a C++ cross-build for GDBserver 
in order to debug a program on the target.

Tested on x86_64-suse-linux and arm-linux-androideab, OK for mainline?


2017-06-02  Eric Botcazou  <ebotcazou@adacore.com>

        * configure.ac (*-*-linux-android*): Set target_makefile_frag.
        * configure: Regenerate.
config/
        * mt-android: New file.
libstdc++-v3/
        * src/filesystem/dir.cc (fs::_Dir::advance): Use std::exchange.

-- 
Eric Botcazou
Index: config/mt-android
===================================================================
--- config/mt-android	(revision 0)
+++ config/mt-android	(working copy)
@@ -0,0 +1 @@
+CXXFLAGS_FOR_TARGET += -D_GNU_SOURCE -fexceptions -frtti
Index: configure.ac
===================================================================
--- configure.ac	(revision 248140)
+++ configure.ac	(working copy)
@@ -2474,6 +2474,9 @@ case "${target}" in
   nios2-*-elf*)
     target_makefile_frag="config/mt-nios2-elf"
     ;;
+  *-*-linux-android*)
+    target_makefile_frag="config/mt-android"
+    ;;
   *-*-linux* | *-*-gnu* | *-*-k*bsd*-gnu | *-*-kopensolaris*-gnu)
     target_makefile_frag="config/mt-gnu"
     ;;
Index: libstdc++-v3/src/filesystem/dir.cc
===================================================================
--- libstdc++-v3/src/filesystem/dir.cc	(revision 248140)
+++ libstdc++-v3/src/filesystem/dir.cc	(working copy)
@@ -146,7 +146,8 @@ fs::_Dir::advance(error_code* ec, direct
 
   int err = std::exchange(errno, 0);
   const auto entp = readdir(dirp);
-  std::swap(errno, err);
+  // std::swap cannot be used with Bionic's errno
+  err = std::exchange(errno, err);
 
   if (entp)
     {

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]