From patchwork Wed Aug 14 15:01:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans-Peter Nilsson X-Patchwork-Id: 1972450 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=axis.com header.i=@axis.com header.a=rsa-sha256 header.s=selector1 header.b=HH9DxuO4; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WkWgJ2dFfz1yZl for ; Thu, 15 Aug 2024 01:01:48 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1212B385B508 for ; Wed, 14 Aug 2024 15:01:46 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from AM0PR83CU005.outbound.protection.outlook.com (mail-westeuropeazlp170100000.outbound.protection.outlook.com [IPv6:2a01:111:f403:c201::]) by sourceware.org (Postfix) with ESMTPS id 5CD623858D34; Wed, 14 Aug 2024 15:01:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5CD623858D34 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=axis.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=axis.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5CD623858D34 Authentication-Results: server2.sourceware.org; arc=pass smtp.remote-ip=2a01:111:f403:c201:: ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1723647680; cv=pass; b=P410ITYXhZYqHAknHNCtHSFIve+2tiKLS+TAr2pD+IqWLwL/EeJbEzVF8xDj4BP9lcGcjxUjIfCf14qRD9fm+QzUpFPsNdnseWM2/PhmOZQszsJXDMrNQYOReHPTYaNwFAa3vYxwPjkFhONjS4MyGHSQJEPpcxJw8qagcd9NXKI= ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1723647680; c=relaxed/simple; bh=K+5bu3a0JnNzYHRot8G0d7PenypM3Iicu/uwc7p44Ss=; h=DKIM-Signature:From:To:Subject:MIME-Version:Message-ID:Date; b=jORQKVJVCHWDJb0mXagTRIM0Q0ZC9wgxvCd9dE7KtnMwzBnDrrosrhZYnuSQBa3z/p1QAI0GmNT2hzwrXJkecHyRJS68l8CUnPrVM43UWW2dA+b8l7gZowJJqV5ez/3ojjKI/3tbUuqgkr39Xjyw3vuD7CNB5GL0gcxOsDEq9hU= ARC-Authentication-Results: i=2; server2.sourceware.org ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U1tlfFt/FXwVaAdt7zf7dblHmL4otlQWW0/hSwPV5znaijSJuqZUk/v1e1Nv/m7ypnbvi44yxnBobsXih6vfBdPLehgQs5MKyaC+Ca9L68zxtNLTdo79O95bo5ULFs44gmgXuFF4sDB4+cvwZ75SyfC15x+cyNe7wRKgppfSEH2hMB2Nb4ChR6IEqDslb27xF8AuTs9S8c/MGVGEAknirHRgeOiUAyV5JIF+rGljtDDNm0ze7YnUf8W3jdb8bK+3uMGvlmn1ILEGTnbSTvr5bS20LypqN3+1ovQIyXlpkZdz165B1QQan0dOnJUsMfI9ut0pcBieH2WKTOH+cBU4lQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z0WafEmWtdi8dRSdm2Svh2xYGEbHoNv2ifz6G7V2arI=; b=Zfyeefk3yj9BDps/PeFaABIMHA2NIvL4rt4Jvmxf2yK4kcdfUUdzRTqxqhc9mI4KBM1JUJc+pEo5RyO7LEMxM1ALR0Xid20yzIeeN5RE8ktX9GcB2bk54ofV8VPBTKhLOLiIDi45EzgPkCb9UW5ji+409nd+oymWPjRMcENWreabV2KI7+fhI3ksxKuSV5ng1Zqi7JkscFrG83i6Ox3qvfoVzJaNuz3O7NlC76I++sQ9qI52Qu+/FmBJO4qBxFk1eMBknVOr8f7ociAKG50xH7AcFkUSddi72i2T8YUZqgruJSC7MnuA8gAo7FRq2ZSC+EH7i/W8e9UOq7iY9iJhTg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 195.60.68.100) smtp.rcpttodomain=gcc.gnu.org smtp.mailfrom=axis.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=axis.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Z0WafEmWtdi8dRSdm2Svh2xYGEbHoNv2ifz6G7V2arI=; b=HH9DxuO41hjmBtvIdCFvHDtDNGmZySqAFvzjRdJmQ6XD8rLl9m0bTdR1lYPuubPEqXpzRDgnJP1Q033aCzS6ezLtpjpqFTK+3R9oOLN5Mm++CPZPBySgVoAwty9fbVpQzmVDu7zouzTKAubGsFYOGb56OA1w1rnEtq6truzhWkU= Received: from AS9P250CA0024.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:532::29) by DB8PR02MB5756.eurprd02.prod.outlook.com (2603:10a6:10:115::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.22; Wed, 14 Aug 2024 15:01:16 +0000 Received: from AM4PEPF00027A60.eurprd04.prod.outlook.com (2603:10a6:20b:532:cafe::b9) by AS9P250CA0024.outlook.office365.com (2603:10a6:20b:532::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7849.23 via Frontend Transport; Wed, 14 Aug 2024 15:01:16 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 195.60.68.100) smtp.mailfrom=axis.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=axis.com; Received-SPF: Pass (protection.outlook.com: domain of axis.com designates 195.60.68.100 as permitted sender) receiver=protection.outlook.com; client-ip=195.60.68.100; helo=mail.axis.com; pr=C Received: from mail.axis.com (195.60.68.100) by AM4PEPF00027A60.mail.protection.outlook.com (10.167.16.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7849.8 via Frontend Transport; Wed, 14 Aug 2024 15:01:15 +0000 Received: from SE-MAILARCH01W.axis.com (10.20.40.15) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 14 Aug 2024 17:01:15 +0200 Received: from se-mail02w.axis.com (10.20.40.8) by SE-MAILARCH01W.axis.com (10.20.40.15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Wed, 14 Aug 2024 17:01:15 +0200 Received: from se-intmail01x.se.axis.com (10.0.5.60) by se-mail02w.axis.com (10.20.40.8) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Wed, 14 Aug 2024 17:01:15 +0200 Received: from pchp3.se.axis.com (pchp3.se.axis.com [10.88.21.53]) by se-intmail01x.se.axis.com (Postfix) with ESMTP id 34D571DA; Wed, 14 Aug 2024 17:01:15 +0200 (CEST) Received: by pchp3.se.axis.com (Postfix, from userid 171) id 303572043B; Wed, 14 Aug 2024 17:01:15 +0200 (CEST) From: Hans-Peter Nilsson To: , Subject: [PATCH] libstdc++-v3: Handle iconv as optional for newlib builds [PR116362] MIME-Version: 1.0 Message-ID: <20240814150115.303572043B@pchp3.se.axis.com> Date: Wed, 14 Aug 2024 17:01:15 +0200 X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM4PEPF00027A60:EE_|DB8PR02MB5756:EE_ X-MS-Office365-Filtering-Correlation-Id: d7284f1a-6cbf-489e-d6b5-08dcbc71f21c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|82310400026|36860700013|1800799024; X-Microsoft-Antispam-Message-Info: c9dYu+RoOHYgNDew1BGNnGkOnsTcbwiGwhQAKgGrgcvEndEcWfIgqmcHTz+sxW65LwUEa+7tg78TWmJJDr9fT+POA/P4aN5fvMwW5fzreau/3S79x31y2OGQWFvqizLugRJ+fACNhUl/GWMWH2lGW8dsRp4NCfVdoZxu4iYPZL7bvak39jmmJ9UUzS/w4NpPRbUxEMgHKJkn2O3a3/8lG38IMv7BJJkzg5qsltBxek13HSOc8sMz6/ETaQ9KIg+E7THYu6Xv5NckZWMoZE9Xt3s5L41pTgUrPhQXIiYU0+OpWJ7HBRzknR/ax4yTohsgPBcZvdrLhvMHKoxO80Qn8MDcIPKOLTyfuq9dNriZKX8oVOM5fzpw+JuaTr5la6IsHrnkNkjVVhFhBeJ0YsJS7Vi6HqZfnBbdmID4/gGnTbKXWm9WvCktVY1AbhI67S5b1g325Ehivp9d1tyxS+fO+OO7MngZKX7DLCdxnbKkG+DZw1cyhZ3hVQ0XzpIhIAADKH1FHros65e3BSwtqDgMzOcHC6azVRgnza6EXrPG/oaHkb23C/g1x4U/QMW/f9bIAuRurkbcwRHmKou3eNi3TOO1B+t+mnff9JJZAmIS2LTOkhiCjo5pL7AphKCnmGfdt6RFtI/JQnGA12dXR/JX2XniQ38O0siGerWwDyiPaG9L/SssZ1dUDATtKgBjyxerBzozjEVwQabjWI2tuvcf4B8f0bflMsfNKDzQ9vuQ65oPDzvhAaSREsHuuE9iV5w5 X-Forefront-Antispam-Report: CIP:195.60.68.100; CTRY:SE; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.axis.com; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(376014)(82310400026)(36860700013)(1800799024); DIR:OUT; SFP:1101; X-OriginatorOrg: axis.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Aug 2024 15:01:15.8601 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d7284f1a-6cbf-489e-d6b5-08dcbc71f21c X-MS-Exchange-CrossTenant-Id: 78703d3c-b907-432f-b066-88f7af9ca3af X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=78703d3c-b907-432f-b066-88f7af9ca3af; Ip=[195.60.68.100]; Helo=[mail.axis.com] X-MS-Exchange-CrossTenant-AuthSource: AM4PEPF00027A60.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR02MB5756 X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_PASS, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Regtested cris-elf, both an older newlib (FWIW: before the getentropy issue that I hoped to investigate before summer...maybe next summer) and a fresh checkout, both with/without --enable-newlib-iconv. I'm pleasantly surprised that it works (there are no regressions) with newlib iconv enabled compared to without: I had to double-check the different libstdc++-v3/config.log that it actually *was* enabled. Ok to commit? -- >8 -- Support for iconv in newlib seems to have been always assumed present by libstdc++-v3, but is default off. Though, it hasn't been used before recent libstdc++ changes that actually call iconv functions. This now leads to failures exposed by running the test-suite, unless the newlib being used has been explicitly configured with --enable-newlib-iconv. When failing, there are undefined references to iconv, iconv_open or iconv_close for multiple tests. Thankfully there's a macro in newlib.h that we can check to detect presence of iconv support for the newlib build that's used. libstdc++-v3: PR libstdc++/116362 * configure.ac: Check newlib configuration whether iconv is enabled. * configure: Regenerate. --- libstdc++-v3/configure | 26 +++++++++++++++++++++++++- libstdc++-v3/configure.ac | 10 +++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index ccb24a82be79..4049f54bd5a3 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -376,7 +376,15 @@ dnl # rather than hardcoding that information. frexpl hypotl ldexpl log10l logl modfl powl sinhl sinl sqrtl tanhl tanl]) - AC_DEFINE(HAVE_ICONV) + # Support for iconv in newlib is configurable. + AC_TRY_COMPILE([#include ], [ + #ifndef _ICONV_ENABLED + #error + #endif], [ac_newlib_iconv_enabled=yes], [ac_newlib_iconv_enabled=no]) + if test "$ac_newlib_iconv_enabled" = yes; then + AC_DEFINE(HAVE_ICONV) + fi + AC_DEFINE(HAVE_MEMALIGN) case "${target}" in diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure index fe525308ae28..305675eaa1e1 100755 --- a/libstdc++-v3/configure +++ b/libstdc++-v3/configure @@ -28571,7 +28571,31 @@ _ACEOF - $as_echo "#define HAVE_ICONV 1" >>confdefs.h + # Support for iconv in newlib is configurable. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + #ifndef _ICONV_ENABLED + #error + #endif + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_newlib_iconv_enabled=yes +else + ac_newlib_iconv_enabled=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test "$ac_newlib_iconv_enabled" = yes; then + $as_echo "#define HAVE_ICONV 1" >>confdefs.h + + fi $as_echo "#define HAVE_MEMALIGN 1" >>confdefs.h