From patchwork Fri May 24 15:00:42 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: 1939008 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=cjFi1at+; 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 4Vm7XT02Dkz20Q0 for ; Sat, 25 May 2024 01:01:12 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 49E2B38708A7 for ; Fri, 24 May 2024 15:01:06 +0000 (GMT) X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by sourceware.org (Postfix) with ESMTPS id CCDB83857C4F for ; Fri, 24 May 2024 15:00:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CCDB83857C4F 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 CCDB83857C4F Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::52f ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716562849; cv=none; b=lgpRq54ibQCmin7PHjbhf5TsoMogG9lwsXDoogNFnB0ViMhF/B4XeZDFS/wW9bBddHO6MKM57NqeLWZWTk12imHqOUORJrhQkx1q+NtFhywCkZm6UpuipPF86JAB9ZOT0JdCMoqolFx8vg7G4Qetwdb8BXMouIs4L0wk+B4Kl+A= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716562849; c=relaxed/simple; bh=Gb2Gi6QF+HgfnpfdKLni/AJ1/uiDqm+GB4rdk+R4AVM=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=h2hnMfSNKlumgl4Z6dTdft8VoMmn1fCPtue+w24lOIfS5NLQ1EzIvR+K06syTrd5iAW4WVjDjrOQqZTNZYIYGaOHFez8IdfiKspU5raF63mBsW6Nyh5e2od6tK0XHVHHZMLn1Fbk6/OKXfJYzQpFayVLr/jZIVhb150Lg5KkxJk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-6818e31e5baso830389a12.1 for ; Fri, 24 May 2024 08:00:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716562844; x=1717167644; darn=sourceware.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=Gu4fGF/tYNEeHmKM0nN932YRlmniN92II4iH+Pf1rTc=; b=cjFi1at+T0wsOj1nCHa2LXG9S+w56pWQv1rZ0ziuHMV5Hm1cGVeZaTkGSUuIl7mPXV gx2YMKmNhqNCTHL2ix45IjG9FKbEt4uZnP4gjCbDVLhGXbogpNOpHSPSdOSPAdRjIDI0 FvVUV5VizSNOoEa7b6YaunVX8rg5cNRGBk/ZXTNxcWyHaxx0qa+SOtfGJMTtCufhBefQ XfQ5zFE9kJMspVc7B+OcQCI95KhXzoGTmAoN591PpR7G98R9rn3Xh+3Y3NGf0Sz0hqRN C+CoNFn+cYqa3oAPD6EyG54amHJsh6A3yC34urNOOxdEAPIkDretKdY7kXjyszanGpMW lc5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716562844; x=1717167644; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Gu4fGF/tYNEeHmKM0nN932YRlmniN92II4iH+Pf1rTc=; b=nKYgJCTDEmJDxfmoBqHPedzPMkKgBINpHxV4UDuwcTI6iOpEwA4uu3x4PiAxN12knV uwbX4HwZ+10iHRhsqLz7+/zrqBZCfu68EHNSSpKoABO2Gw6YZ/KU7rWpkTaNfTdLumji HS0IJw9MmMUYO8jgGS5cPwlKXW4IklqMGJDAsRG5OCVZa9cS8AODgr/LLdS4bI5CYrK7 3tU3Jsmjdo86j9+dAWn8GcyBSMTNQWd7nkfwjz2nV1ykwhjc/ViV0itr1G6KDv4z4QAo moka1ymmSXtsTRvhvIeNPo+H8SlBG5YF5fJ49gn/HpKdNOo8YsVmBW9ZruyXy/bYIgdc vUbQ== X-Gm-Message-State: AOJu0Yzu4j3ieKxTtqag0BVFTo73x2yfGnyaa4lfy65rOYFJoj4UOZ90 ehM5y1qUwqQPDl1ziNPrE7oGLOvMm/K+ow2KBuKlMb/NZS1xej9+AySB5Q== X-Google-Smtp-Source: AGHT+IHZUQOTqGf9S2YrPh/+5UY12MU+RzgrO5AHG5OLpcpuIGwxeb3lXAQ06LXTWeLtCwYxwBeMVQ== X-Received: by 2002:a05:6a20:a10c:b0:1af:d057:be95 with SMTP id adf61e73a8af0-1b212ccf88bmr3559029637.11.1716562844024; Fri, 24 May 2024 08:00:44 -0700 (PDT) Received: from gnu-cfl-3.localdomain ([172.59.129.178]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-6f8fcbf5388sm1203125b3a.136.2024.05.24.08.00.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 08:00:43 -0700 (PDT) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id A5CF77405A7 for ; Fri, 24 May 2024 08:00:42 -0700 (PDT) From: "H.J. Lu" To: libc-alpha@sourceware.org Subject: [PATCH] Always define __nldbl__IO_vfscanf in libc.a [BZ #31776] Date: Fri, 24 May 2024 08:00:42 -0700 Message-ID: <20240524150042.2125798-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.45.1 MIME-Version: 1.0 X-Spam-Status: No, score=-3022.0 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 always defining __nldbl__IO_vfscanf in libc.a since it is used in libnldbl_nonshared.a. Signed-off-by: H.J. Lu --- sysdeps/ieee754/ldbl-opt/Makefile | 11 ++++++ sysdeps/ieee754/ldbl-opt/nldbl-compat.c | 4 +- .../test-nldbl-fscanf-redirect-static.c | 1 + .../test-nldbl-fscanf-redirect-static.input | 1 + .../ldbl-opt/test-nldbl-fscanf-redirect.c | 37 +++++++++++++++++++ .../ldbl-opt/test-nldbl-fscanf-redirect.input | 1 + 6 files changed, 54 insertions(+), 1 deletion(-) 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 839a22689c..78fe053180 100644 --- a/sysdeps/ieee754/ldbl-opt/Makefile +++ b/sysdeps/ieee754/ldbl-opt/Makefile @@ -241,7 +241,12 @@ tests += \ tst-nldbl-scanf-binary-c23 \ tst-nldbl-scanf-binary-gnu11 \ tst-nldbl-scanf-binary-gnu89 \ + test-nldbl-fscanf-redirect \ + test-nldbl-fscanf-redirect-static \ # 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 @@ -255,6 +260,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..31aba4038c 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c @@ -274,7 +274,9 @@ __nldbl_wprintf (const wchar_t *fmt, ...) return ret; } -#if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29) +/* Always define __nldbl__IO_vfscanf in libc.a since it is used in + libnldbl_nonshared.a. */ +#if !defined SHARED || SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_29) int attribute_compat_text_section __nldbl__IO_vfscanf (FILE *s, const char *fmt, va_list ap, int *errp) 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..8438aabe42 --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect-static.input @@ -0,0 +1 @@ +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..566d908d9e --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.c @@ -0,0 +1,37 @@ +/* Test fscanf 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 + . */ + +#include + +struct FILE; +extern struct FILE *stdin; +extern int fscanf (struct FILE *, const char *, ...); + +int +main (void) +{ + int n, i; + long double x; + char name[50]; + n = fscanf (stdin, "%d%Lf%s", &i, &x, name); + + if (n != 3 || i != 25 || x != 5.432 || strcmp (name, "thompson")) + return 1; + + return 0; +} 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..8438aabe42 --- /dev/null +++ b/sysdeps/ieee754/ldbl-opt/test-nldbl-fscanf-redirect.input @@ -0,0 +1 @@ +25 54.32E-1 thompson