From patchwork Fri May 24 20:48:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 1939092 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=OVNHAjHZ; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=server2.sourceware.org; envelope-from=libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.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 4VmHGg4Z1Bz1ynR for ; Sat, 25 May 2024 06:49:47 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E491D3857C4F for ; Fri, 24 May 2024 20:49:45 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pf1-x434.google.com (mail-pf1-x434.google.com [IPv6:2607:f8b0:4864:20::434]) by sourceware.org (Postfix) with ESMTPS id D70E83858CD9 for ; Fri, 24 May 2024 20:48:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D70E83858CD9 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D70E83858CD9 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::434 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716583730; cv=none; b=TfI0tnrP0/JzNw0eMb8vqVlGTo3yc6i2oUCg3XlPADnbInkwHWzg+p+2MewO2bnFqidpgMJbn6NobmcnrUJ7Pk9iYxNz1BeIwaLBXhlk4GucaLiWOYn+pSInPcydmAbEd3rVsqg5/itK/6FBQOIrWIA0S+ykWb+3k0JuqZF9Ox4= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716583730; c=relaxed/simple; bh=Jd4aE7T4Z4ne1TvJuyExksootYI8VAYsIyNxUtJXiFE=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VRQPZRbkxk+MIKp9+zeVA2l8SGdFLHSAGxCW923WZ3URVbik7e24YLQal+Uq2iaxY4+SzSTGKVgfjxI8ZumNwrh87QEqMKhC/NLjQuhnczq/WOUo+i65mGb7bceVKHNv1f4CILOY3GeynGjrSlEZYCynzNhusm4Soj04C4c8ibA= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pf1-x434.google.com with SMTP id d2e1a72fcca58-6f8f34cb0beso971080b3a.1 for ; Fri, 24 May 2024 13:48:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716583727; x=1717188527; darn=sourceware.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dMtSDhlUJ0nuy9U/hEi/JBIYYZzRFrKvqZt/IRceX80=; b=OVNHAjHZvtO99sJYqDHw76+CGxB1JRr9dFfXIFSAweFKHk5yW2JqTgjwAAikegNnLt alOkWTCEx7vG28AwGAVQ0DhiHYOolOr/kTihCvmr8xGD9DlXw7JQK3NwzxlQYGBb7rOR htXtN4m5opByX0RQYv9Ok9tqaRE29CaVvY4IqVjtkpUCgzd4PkA+ioSOZFxYJo4Ouc1t Gv0MA/354EchUbXAc0IPLecCpZdac8iWRolmCG1He1sLdsuxSq26+o5BGwpQ2qI3rQzm WnDbNK2tcBXWNenxqo2W2+HMo9Oy8rTVzcXhP7GisIfDB6Ij31WbcWBRn8zVqSKNozUH Ictg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716583727; x=1717188527; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dMtSDhlUJ0nuy9U/hEi/JBIYYZzRFrKvqZt/IRceX80=; b=fD//FZe126Rha9NPAGPa/MdrYVfyNTYt3DzFTYlR8hMAQzxFHAT9UC2VaRCZKAEZwK lslX2uHIjIgT6NuJi59t4tjlQfJY2Hsr6xm0v7yGk2xlB64TWFEtW8bj3An2X0qe+Ndx F5cuqh5QzOYztXFdgQSVDRoLogjWPjb1dHNdwDD1ceTb9GVOhmvQFLAGgORH3HSDTnBQ 7zsrWdG9uRFYE3NqYQGM6i+SDEfE6ipuKAzCV6YydznZ5Z84qQKI9Qk+QZINqu59Abzp YiHAi+FquViFhrxad+JJuY4dU4+2BX6rq4Hjds+imNC01+Fd5WcD+3mV3WctmIpWlFtm DD1Q== X-Gm-Message-State: AOJu0YwNBYjj02U0j4gae1MQqQgolcbJj2V4yp2U7RnTkVNIRBirCY9h Tuc9a1j4bmXcT3oj5MDVP7f8WieeIwXU5bjFHvR++K4Xk1MpeuZN X-Google-Smtp-Source: AGHT+IEj93mkHKdRCS0h3mhFyyAWpbheTRCHKw3E/sVpwcpwprM3yef4SRAbaAwGmzqs8ueSpsnipw== X-Received: by 2002:a05:6a21:78a3:b0:1af:37bf:d7de with SMTP id adf61e73a8af0-1b212ce3e56mr4762176637.7.1716583726477; Fri, 24 May 2024 13:48:46 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.59.129.178]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fd4e36f9sm1577342b3a.216.2024.05.24.13.48.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 13:48:46 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 0E6097407DB; Fri, 24 May 2024 13:48:45 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Cc: fweimer@redhat.com Subject: [PATCH v2 2/2] Make __nldbl__IO_vfscanf a compat symbol [BZ #31776] Date: Fri, 24 May 2024 13:48:44 -0700 Message-ID: <20240524204844.3322444-3-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240524204844.3322444-1-hjl.tools@gmail.com> References: <20240524204844.3322444-1-hjl.tools@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-3021.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libc-alpha-bounces+incoming=patchwork.ozlabs.org@sourceware.org Fix BZ #31776 by 1. Making __nldbl__IO_vfscanf a compat symbol. 2. Remove _IO_vfscanf from libnldbl_nonshared.a. Since _IO_vfscanf is a compat symbol, there is no point to provide it in libnldbl_nonshared.a. 3. Change libnldbl_nonshared.a to call __nldbl_vfscanf, instead of __nldbl__IO_vfscanf. Add fscanf/scanf/vfscanf/vscanf tests of long double as double without including . Signed-off-by: H.J. Lu --- sysdeps/ieee754/ldbl-opt/Makefile | 12 ++++++++++- sysdeps/ieee754/ldbl-opt/nldbl-compat.c | 4 ++++ sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c | 2 +- sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c | 13 ------------ sysdeps/ieee754/ldbl-opt/nldbl-scanf.c | 2 +- sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c | 2 +- sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c | 2 +- .../test-nldbl-fscanf-redirect-static.c | 1 + .../test-nldbl-fscanf-redirect-static.input | 4 ++++ .../ldbl-opt/test-nldbl-fscanf-redirect.c | 21 +++++++++++++++++++ .../ldbl-opt/test-nldbl-fscanf-redirect.input | 4 ++++ 11 files changed, 49 insertions(+), 18 deletions(-) delete mode 100644 sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c create mode 100644 sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.c create mode 100644 sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.input create mode 100644 sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.c create mode 100644 sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.input diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile index d1eda5d022..81cb5b3a53 100644 --- a/sysdeps/ieee754/ldbl-opt/Makefile +++ b/sysdeps/ieee754/ldbl-opt/Makefile @@ -101,7 +101,6 @@ libnldbl-calls = \ getpayload \ hypot \ ilogb \ - iovfscanf \ isinf \ isnan \ isoc23_fscanf \ @@ -428,11 +427,16 @@ endif ifeq ($(subdir), stdio-common) tests += \ + test-nldbl-fscanf-redirect \ + test-nldbl-fscanf-redirect-static \ tst-nldbl-scanf-binary-c11 \ tst-nldbl-scanf-binary-c23 \ tst-nldbl-scanf-binary-gnu11 \ tst-nldbl-scanf-binary-gnu89 \ # tests +tests-static += \ + test-nldbl-fscanf-redirect-static \ +# tests-static # Some versions of GCC supported for building glibc do not support -std=c23 # (added in GCC 14), or the older name -std=c2x (added in GCC 9), so @@ -446,6 +450,12 @@ CFLAGS-tst-nldbl-scanf-binary-gnu11.c += -mlong-double-64 -std=gnu11 \ -DOBJPFX=\"$(objpfx)\" CFLAGS-tst-nldbl-scanf-binary-gnu89.c += -mlong-double-64 -std=gnu89 \ -DOBJPFX=\"$(objpfx)\" +CFLAGS-test-nldbl-fscanf-redirect.c += -mlong-double-64 +CFLAGS-test-nldbl-fscanf-redirect-static.c += -mlong-double-64 +$(objpfx)test-nldbl-fscanf-redirect: \ + $(common-objpfx)math/libnldbl_nonshared.a +$(objpfx)test-nldbl-fscanf-redirect-static: \ + $(common-objpfx)math/libnldbl_nonshared.a endif diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c index f0bfb1e8a1..b05e47f185 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c @@ -1336,3 +1336,7 @@ compat_symbol (libc, __nldbl___fprintf_chk, __fprintf_chk, GLIBC_2_3_4); compat_symbol (libc, __nldbl___vprintf_chk, __vprintf_chk, GLIBC_2_3_4); compat_symbol (libc, __nldbl___vfprintf_chk, __vfprintf_chk, GLIBC_2_3_4); #endif +#if SHLIB_COMPAT (libc, LONG_DOUBLE_COMPAT_VERSION, GLIBC_2_29) +compat_symbol (libc, __nldbl__IO_vfscanf, __nldbl__IO_vfscanf, + LONG_DOUBLE_COMPAT_VERSION); +#endif diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c index 00507187f3..8f762944b9 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-fscanf.c @@ -13,7 +13,7 @@ fscanf (FILE *stream, const char *fmt, ...) int done; va_start (arg, fmt); - done = __nldbl__IO_vfscanf (stream, fmt, arg, NULL); + done = __nldbl_vfscanf (stream, fmt, arg); va_end (arg); return done; diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c deleted file mode 100644 index 6ed9b48624..0000000000 --- a/sysdeps/ieee754/ldbl-opt/nldbl-iovfscanf.c +++ /dev/null @@ -1,13 +0,0 @@ -/* This file defines one of the deprecated scanf variants. */ -#include -#undef __GLIBC_USE_DEPRECATED_SCANF -#define __GLIBC_USE_DEPRECATED_SCANF 1 - -#include "nldbl-compat.h" - -int -attribute_hidden -_IO_vfscanf (FILE *s, const char *fmt, va_list ap, int *errp) -{ - return __nldbl__IO_vfscanf (s, fmt, ap, errp); -} diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c index c10da284f2..c7dd1b7bd0 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-scanf.c @@ -13,7 +13,7 @@ scanf (const char *fmt, ...) int done; va_start (arg, fmt); - done = __nldbl__IO_vfscanf (stdin, fmt, arg, NULL); + done = __nldbl_vfscanf (stdin, fmt, arg); va_end (arg); return done; diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c index 6f5ebc3045..076a06fe4f 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c @@ -9,7 +9,7 @@ int attribute_hidden __vfscanf (FILE *s, const char *fmt, va_list ap) { - return __nldbl__IO_vfscanf (s, fmt, ap, NULL); + return __nldbl_vfscanf (s, fmt, ap); } extern __typeof (__vfscanf) vfscanf attribute_hidden; weak_alias (__vfscanf, vfscanf) diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c index 38f654aa73..7560ec5bac 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-vscanf.c @@ -10,5 +10,5 @@ attribute_hidden weak_function vscanf (const char *fmt, va_list ap) { - return __nldbl__IO_vfscanf (stdin, fmt, ap, NULL); + return __nldbl_vfscanf (stdin, fmt, ap); } diff --git a/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.c b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.c new file mode 100644 index 0000000000..0e38f24b5a --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.c @@ -0,0 +1 @@ +#include "test-nldbl-fscanf-redirect.c" diff --git a/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.input b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.input new file mode 100644 index 0000000000..5551d71dab --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.input @@ -0,0 +1,4 @@ +25 54.32E-1 thompson +25 54.32E-1 thompson +25 54.32E-1 thompson +25 54.32E-1 thompson diff --git a/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.c b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.c new file mode 100644 index 0000000000..ae1f0c1a4b --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.c @@ -0,0 +1,21 @@ +/* Test fscanf/scanf/vfscanf/vscanf of long double as double without + . + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#define EXPECTED_LONG_DOUBLE_VALUE 5.432 +#include diff --git a/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.input b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.input new file mode 100644 index 0000000000..5551d71dab --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.input @@ -0,0 +1,4 @@ +25 54.32E-1 thompson +25 54.32E-1 thompson +25 54.32E-1 thompson +25 54.32E-1 thompson