From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id E66DD3858D38 for ; Thu, 23 May 2024 18:29:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E66DD3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E66DD3858D38 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716488998; cv=none; b=LgN6amI/LM507cqf1SnDdw47RzTf77S5bzJjarRf7RfZxB8f3CIL9nXgb8EoBdJHCnWIYEl7MzU78E93K59cS4tHF20NQOsQR2jwb5ymfNzCegJz46zSWj1Jxlg7PEv7aWqFGpCvvAUHzgB/Pp8xonIPB47zLW27fD80EK9V05w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1716488998; c=relaxed/simple; bh=4YBcGPGuG2oL/MY3pyZwhOcDQc7qHYydwlTy7Hs3KTI=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=VDiTs5NHeCCVnlBUBPZgTDGaC6n9Ul2cERLsfyG4kZELX8isAU7u5+wKR1T6L9EfvT/F/NllLyIl2DviMYJdp6Yv+Qus6Wc1iwmXjjtGr7dkL1KfGyeL3faoM5+tk57xnX5XQqASDShN6IjCmOhUU4rpqjbqvBB06TuHoZddlXI= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716488996; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=durt1fqGIbrMDIvH0eE8tBv41fRSYdP3NM8jsL8gzk4=; b=RfVrT17x2j4DuCiMdpNZduL8zDAcLS50egIjzqor3mmaK/eT7ZgvfeLHR61vTXaH5vqWrs m0skK8xUopq46WVzqxvMhI/PVnHoLIGs/TsKvJcKCF2ClcMl3Jp0YIsu1bYtqc10q6kvwF QF5KoK3dZyQfcl8/F3+ZqJ2/gjBropA= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-625-umBImHfqNbKLILXLiEP2Xw-1; Thu, 23 May 2024 14:29:55 -0400 X-MC-Unique: umBImHfqNbKLILXLiEP2Xw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0EE7580118E; Thu, 23 May 2024 18:29:55 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.123]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EDECD40004D; Thu, 23 May 2024 18:29:53 +0000 (UTC) From: Florian Weimer To: "H.J. Lu" Cc: libc-alpha@sourceware.org, adhemerval.zanella@linaro.org Subject: Re: [PATCH v4] Check global symbols in static library against shared library In-Reply-To: (H. J. Lu's message of "Thu, 23 May 2024 09:05:51 -0700") References: <20240523134650.14966-1-hjl.tools@gmail.com> <87cypcprf8.fsf@oldenburg.str.redhat.com> <87zfsgo75f.fsf@oldenburg.str.redhat.com> Date: Thu, 23 May 2024 20:29:52 +0200 Message-ID: <874jaonzz3.fsf@oldenburg.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,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 List-Id: * H. J. Lu: > On Thu, May 23, 2024 at 8:54=E2=80=AFAM Florian Weimer wrote: >> What I meant is that you should probably be able to call scanf >> from a program that is linked with -static -lnldbl, and the bug is the >> missing __nldbl__IO_vfscanf function in libc.a. > > There is no libnldbl.a. Thus is how I expect this to work. With GCC and Clang, we have __asm__ redirect support, so __LDBL_REDIR etc. produce the expected __nldbl_ symbol directly. This happens if you compile with -mlong-double-64 on power64le-linux-gnu, for example, because the compiler defines __LDBL_COMPAT. Without __asm__ redirect support, I assume you are expected to link with -lnldbl_nonshared. This can currently fail with a linker error: /usr/lib/gcc/ppc64le-redhat-linux/8/../../../../lib64/libc.a(vfscanf.o): In= function `___vfscanf': (.text+0x5880): multiple definition of `__vfscanf' /usr/lib/gcc/ppc64le-redhat-linux/8/../../../../lib64/libnldbl_nonshared.a(= nldbl-vfscanf.oS):(.text+0x0): first defined here This appears to be a bug: diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c b/sysdeps/ieee754/ldb= l-opt/nldbl-vfscanf.c index 6f5ebc3045..e3d879cb22 100644 --- a/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c +++ b/sysdeps/ieee754/ldbl-opt/nldbl-vfscanf.c @@ -11,5 +11,4 @@ __vfscanf (FILE *s, const char *fmt, va_list ap) { return __nldbl__IO_vfscanf (s, fmt, ap, NULL); } -extern __typeof (__vfscanf) vfscanf attribute_hidden; weak_alias (__vfscanf, vfscanf) But afterwards, the __nldbl__IO_vfscanf symbol is required. And I see it in our downstream glibc 2.28 variant. But with our glibc 2.34 variant, I get a link failure: /usr/bin/ld: /tmp/ccOU5PJG.o: in function `my_scanf': t.c:(.text+0x5c): undefined reference to `__nldbl__IO_vfscanf' collect2: error: ld returned 1 exit status So your tests have found another genuine bug, I think. Thanks, Florian