From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 35538 invoked by alias); 24 May 2017 07:37:01 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 32770 invoked by uid 89); 24 May 2017 07:35:12 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-10.1 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,KAM_ASCII_DIVIDERS,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-User: qpsmtpd, 2 recipients X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 24 May 2017 07:35:11 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 514C581361; Wed, 24 May 2017 09:35:13 +0200 (CEST) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eEQZokgiZYon; Wed, 24 May 2017 09:35:13 +0200 (CEST) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id 2DC488135D; Wed, 24 May 2017 09:35:13 +0200 (CEST) From: Eric Botcazou 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 Message-ID: <2201607.crUaWaPvls@polaris> User-Agent: KMail/4.14.10 (Linux/3.16.7-53-desktop; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="nextPart1545637.EWkf4sd1VC" Content-Transfer-Encoding: 7Bit X-SW-Source: 2017-05/txt/msg01826.txt.bz2 This is a multi-part message in MIME format. --nextPart1545637.EWkf4sd1VC Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Content-length: 553 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 * 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 --nextPart1545637.EWkf4sd1VC Content-Disposition: attachment; filename="p.diff" Content-Transfer-Encoding: 7Bit Content-Type: text/x-patch; charset="UTF-8"; name="p.diff" Content-length: 1194 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) { --nextPart1545637.EWkf4sd1VC--