public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: libc-alpha@sourceware.org,  adhemerval.zanella@linaro.org
Subject: Re: [PATCH v4] Check global symbols in static library against shared library
Date: Thu, 23 May 2024 21:42:47 +0200	[thread overview]
Message-ID: <87v834mi14.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <CAMe9rOpDDvTtEtU+=aZcxK1BOmoxUZTt2iTaEhbvAZNYKFBO0g@mail.gmail.com> (H. J. Lu's message of "Thu, 23 May 2024 11:39:54 -0700")

* H. J. Lu:

>> 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.
>>
>
> Can you open a glibc bug?  We should fix it with a testcase.
> What should happen to __nldbl__IO_vfscanf in libc.a and libc.so?

Digging somewhat further, I believe this was an intentional change as
part of this commit:

commit 349718d4d7841df46bcc36df9bc2baef4c40d6f5
Author: Zack Weinberg <zackw@panix.com>
Date:   Wed Mar 7 14:31:58 2018 -0500

    Add __vfscanf_internal and __vfwscanf_internal with flags arguments.

(The commit message has a longer explanation of the change.)

It is this part which I expect causes the change to be dropped from the
static build:

diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
index 7a1e89c1a3..91ea27a423 100644
--- a/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-compat.c
@@ -330,16 +330,20 @@ __nldbl_wprintf (const wchar_t *fmt, ...)
   return done;
 }
 
+#if 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)
 {
   int res;
   set_no_long_double ();
-  res = _IO_vfscanf (s, fmt, ap, errp);
+  res = __vfscanf_internal (s, fmt, ap, 0);
   clear_no_long_double ();
+  if (__glibc_unlikely (errp != 0))
+    *errp = (res == -1);
   return res;
 }
+#endif
 
 int
 attribute_compat_text_section

But __nldbl__IO_vfscanf is not marked as a compat symbol:

# eu-readelf --symbols=.dynsym /lib64/libc.so.6 | grep __nldbl__IO_vfscanf
 1203: 00000000001c2240    132 FUNC    GLOBAL DEFAULT       11 __nldbl__IO_vfscanf@@GLIBC_2.17

And this must be what trips your test case.  We should turn it into a
compat symbol, rather than fixing the test case.

Thanks,
Florian


  reply	other threads:[~2024-05-23 19:42 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-23 13:46 H.J. Lu
2024-05-23 13:51 ` Florian Weimer
2024-05-23 13:58   ` H.J. Lu
2024-05-23 15:54     ` Florian Weimer
2024-05-23 16:05       ` H.J. Lu
2024-05-23 18:29         ` Florian Weimer
2024-05-23 18:39           ` H.J. Lu
2024-05-23 19:42             ` Florian Weimer [this message]
2024-05-23 19:54               ` H.J. Lu
2024-05-23 20:00                 ` Florian Weimer
2024-05-23 20:10                   ` H.J. Lu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87v834mi14.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=hjl.tools@gmail.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).