From patchwork Wed Nov 30 19:00:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bernd Edlinger X-Patchwork-Id: 85907 Delivered-To: patch@linaro.org Received: by 10.140.20.101 with SMTP id 92csp366400qgi; Wed, 30 Nov 2016 11:01:28 -0800 (PST) X-Received: by 10.99.143.90 with SMTP id r26mr61928679pgn.164.1480532488757; Wed, 30 Nov 2016 11:01:28 -0800 (PST) Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id a128si65628086pfa.23.2016.11.30.11.01.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Nov 2016 11:01:28 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-443113-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org; spf=pass (google.com: domain of gcc-patches-return-443113-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-443113-patch=linaro.org@gcc.gnu.org DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type:mime-version; q=dns; s= default; b=W7NGRB59Ftiyl8cmAUtdk3RM0NapAsAlMQe6wiaX42+4qV+jU7pwt A3p3uS5L0HaZp+2m8nU118G13ZT9KC+l7+KIXAqIr7b1F+VW0vYFr8s8+RplXRcM f2mfbi6ZguL59Gz5SbCGMnvdzpnL0loVYHfTAq10kUH1eV5oppTa8A= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type:mime-version; s= default; bh=2UFh1GhDnSFrKJsCxM+BLlTWWtU=; b=QM4yFuq9RM83LURkEJNn WWJGUxpMAkqloo3UQoQ8w+kSCNqTfrCVsqRjUjXfsvSPd0OHXLpfBiEwO3J33g3p 3zbX+lC7+Lg3jTY0WXxrU58l42mlrHHJLwVj/ylL9TeGsK7cHXyaoYqhWwBcyCs+ PKEAd7ghbea5Apv+FUrLoow= Received: (qmail 104107 invoked by alias); 30 Nov 2016 19:01:10 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 104079 invoked by uid 89); 30 Nov 2016 19:01:09 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 spammy=Hx-languages-length:1896, HX-MS-Has-Attach:yes, Hx-spam-relays-external:65.55.90.199, H*RU:65.55.90.199 X-Spam-User: qpsmtpd, 2 recipients X-HELO: SNT004-OMC4S20.hotmail.com Received: from snt004-omc4s20.hotmail.com (HELO SNT004-OMC4S20.hotmail.com) (65.55.90.223) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 30 Nov 2016 19:00:59 +0000 Received: from EUR02-AM5-obe.outbound.protection.outlook.com ([65.55.90.199]) by SNT004-OMC4S20.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Wed, 30 Nov 2016 11:00:57 -0800 Received: from HE1EUR02FT007.eop-EUR02.prod.protection.outlook.com (10.152.10.56) by HE1EUR02HT166.eop-EUR02.prod.protection.outlook.com (10.152.11.142) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.4; Wed, 30 Nov 2016 19:00:55 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com (10.152.10.55) by HE1EUR02FT007.mail.protection.outlook.com (10.152.10.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.734.4 via Frontend Transport; Wed, 30 Nov 2016 19:00:55 +0000 Received: from AM4PR0701MB2162.eurprd07.prod.outlook.com ([10.167.132.147]) by AM4PR0701MB2162.eurprd07.prod.outlook.com ([10.167.132.147]) with mapi id 15.01.0761.009; Wed, 30 Nov 2016 19:00:55 +0000 From: Bernd Edlinger To: "libstdc++@gcc.gnu.org" , "gcc-patches@gcc.gnu.org" , Jonathan Wakely Subject: [PATCH, libstdc++] Fix detection of posix_memalig for cross-builds Date: Wed, 30 Nov 2016 19:00:55 +0000 Message-ID: authentication-results: gcc.gnu.org; dkim=none (message not signed) header.d=none; gcc.gnu.org; dmarc=none action=none header.from=hotmail.de; x-incomingtopheadermarker: OriginalChecksum:; UpperCasedChecksum:; SizeAsReceived:7293; Count:34 x-ms-exchange-messagesentrepresentingtype: 1 x-incomingheadercount: 34 x-eopattributedmessage: 0 x-microsoft-exchange-diagnostics: 1; HE1EUR02HT166; 5:d+clGCI7uaI+6GjSUCb52jqMqgi1MtvizUp/2I1JZVjtNVGK28ImG3gaNE2dcxSMn3cZWbAJJU1X2ovodM/3izBikQ1VkN8Uig0+fdsNsPMnk+q8c/xVBPs2YENdjmESBajyNPonmkgudf2q9XLADdw3hUqkb36z3AJ48sapSZI=; 24:5yQpHAVVJfxNAvbbUxWesR1RZ+gQo/KzXAtu/OXyyPfaS8jYwOL6Yv5o1ksyt60/ijJft1t3ImN5t/qbbESMIatqvYNh2GgGHIsMjKuzlXA=; 7:fMqs5tJMlK1EpyBLTi0NJxqlb7aKWVYElkmmplI8N+J//YV5wf8oVEmPu9UxNaLQjrI1FpWYrmgqyem2C+eEFvqYCoKd1Y2Uz55WY9iZ0uQ+L+2I907b81YhTzJM7J74DeNAiu/CiaF2dpxvn++YNSo6uuXlWXN911m341MQDRjDGfqO57IgAPC9Lz84qGAc8yZM1HcyedUSCpMtrVbawQN0lOMw/ewWi9iyjkVg2PdPx+1jFGHd5ctdoSI50ZeabvozKi7O3zYwdJ+SBvOxqjwppTAh1ose97Xg1E/UBvG6uhtSJhlCJynr6hiP0l8nJtUHv2EJNl8GvHcBfMHqzLgodJIP1OUFU4B+jDPOCyI= x-forefront-antispam-report: EFV:NLI; SFV:NSPM; SFS:(10019020)(98900003); DIR:OUT; SFP:1102; SCL:1; SRVR:HE1EUR02HT166; H:AM4PR0701MB2162.eurprd07.prod.outlook.com; FPR:; SPF:None; LANG:en; x-ms-office365-filtering-correlation-id: 96bd3fc5-5f06-418b-0646-08d4195335dc x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(1601124038)(5061506290)(5061507290)(1603103113)(1601125047); SRVR:HE1EUR02HT166; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(432015012)(102415395)(82015046); SRVR:HE1EUR02HT166; BCL:0; PCL:0; RULEID:; SRVR:HE1EUR02HT166; x-forefront-prvs: 0142F22657 spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-originalarrivaltime: 30 Nov 2016 19:00:55.3313 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Internet X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR02HT166 Hi, I noticed that a cross-compiler produces an unusable libstdc++.so that contains an unresolved reference to aligned_alloc instead of posix_memalign, or whatever is actually available. Therefore it is impossible to link any C++ programs against the libstdc++.so that comes with the cross-compiler. That happens for instance in the following configuration: --target=arm-linux-gnueabihf. The attached patch adds a link test for the memalign function and fixes the cross-build for me. Is it OK for trunk? Thanks Bernd. 2016-11-30 Bernd Edlinger * crossconfig.m4 (*-linux*): Add link-check for memalign. * configure: Regenerated. Index: libstdc++-v3/configure =================================================================== --- libstdc++-v3/configure (revision 242960) +++ libstdc++-v3/configure (working copy) @@ -59826,11 +59826,24 @@ _ACEOF fi done + for ac_func in aligned_alloc posix_memalign memalign _aligned_malloc +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF +fi +done + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if test "${am_cv_func_iconv+set}" = set; then : Index: libstdc++-v3/crossconfig.m4 =================================================================== --- libstdc++-v3/crossconfig.m4 (revision 242960) +++ libstdc++-v3/crossconfig.m4 (working copy) @@ -157,6 +157,7 @@ case "${host}" in AC_DEFINE(_GLIBCXX_USE_RANDOM_TR1) GCC_CHECK_TLS AC_CHECK_FUNCS(__cxa_thread_atexit_impl) + AC_CHECK_FUNCS(aligned_alloc posix_memalign memalign _aligned_malloc) AM_ICONV ;; *-mingw32*)