public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Eric Botcazou <ebotcazou@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: libstdc++-v3@gcc.gnu.org
Subject: [patch] Fix libstdc++-v3 build for Android
Date: Wed, 24 May 2017 07:41:00 -0000	[thread overview]
Message-ID: <2201607.crUaWaPvls@polaris> (raw)

[-- Attachment #1: Type: text/plain, Size: 553 bytes --]

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-05-24  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

[-- Attachment #2: p.diff --]
[-- Type: text/x-patch, Size: 1194 bytes --]

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)
     {

                 reply	other threads:[~2017-05-24  7:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2201607.crUaWaPvls@polaris \
    --to=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=libstdc++-v3@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).