From: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
To: Paul Eggert <eggert@cs.ucla.edu>
Cc: bug-gnulib@gnu.org, libc-alpha@sourceware.org, binutils@sourceware.org
Subject: Re: Undefined use of weak symbols in gnulib
Date: Tue, 27 Apr 2021 08:58:36 +0200 [thread overview]
Message-ID: <87czugp61v.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <ad259dd6-6998-37a4-d893-12457c5a24fe@cs.ucla.edu> (Paul Eggert's message of "Mon, 26 Apr 2021 23:50:26 -0700")
* Paul Eggert:
> On 4/26/21 10:53 PM, Florian Weimer via Libc-alpha wrote:
>> This will become an urgent issue with glibc 2.34, which defines
>> pthread_mutexattr_gettype unconditionally. Certain gnulib modules will
>> stop working until the binaries are relinked.
>
> Thanks for mentioning this. But in what sense will the modules stop
> working? I'm a little lost.
>
> glibc 2.34 also defines pthread_once unconditionally, right? So why
> doesn't code like this:
>
> if (pthread_mutexattr_gettype != NULL)
> pthread_once (control, callback);
>
> continue to work in 2.34?
The link editor does not emitted a relocation referencing the
pthread_once symbol. The function address in the GOT is always zero.
It does not matter if a pthread_once symbol exists at run time because
their is no reference to it. Relinking the executable will of course
fix this and generate a reference to the pthread_once symbol, but
relinking is required.
For example, bison 3.7.4 built against glibc 2.33 has these pthread*
symbol references in its dynamic symbol table on powerpc64le-linux-gnu:
58: 0000000000000000 0 FUNC WEAK DEFAULT UNDEF pthread_mutex_init@GLIBC_2.17 (2)
117: 0000000000000000 0 FUNC WEAK DEFAULT UNDEF pthread_mutex_lock@GLIBC_2.17 (2)
118: 0000000000000000 0 NOTYPE WEAK DEFAULT UNDEF pthread_mutexattr_gettype
120: 0000000000000000 0 FUNC WEAK DEFAULT UNDEF pthread_mutex_unlock@GLIBC_2.17 (2)
pthread_once is just not there.
Thanks,
Florian
next prev parent reply other threads:[~2021-04-27 6:58 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 5:53 Undefined use of weak symbols in gnulib Florian Weimer via Libc-alpha
2021-04-27 6:50 ` Paul Eggert
2021-04-27 6:58 ` Florian Weimer via Libc-alpha [this message]
2021-04-27 7:13 ` Paul Eggert
2021-04-27 7:24 ` Andreas Schwab
2021-04-27 11:06 ` Florian Weimer via Libc-alpha
2021-04-28 0:09 ` Bruno Haible
2021-04-28 2:10 ` H.J. Lu via Libc-alpha
2021-04-28 2:13 ` H.J. Lu via Libc-alpha
2021-05-05 20:31 ` Fangrui Song
2021-04-28 8:35 ` Florian Weimer via Libc-alpha
2021-04-28 13:15 ` Michael Matz
2021-04-28 7:44 ` Florian Weimer via Libc-alpha
2021-04-28 14:48 ` Bruno Haible
2021-04-28 17:44 ` Florian Weimer via Libc-alpha
2021-07-17 14:38 ` Bruno Haible
2021-07-17 14:55 ` Florian Weimer via Libc-alpha
2021-07-17 16:39 ` Bruno Haible
2021-07-27 20:02 ` Joseph Myers
2021-07-27 20:19 ` Florian Weimer via Libc-alpha
2021-07-27 23:38 ` Paul Eggert
2021-04-27 23:22 ` Bruno Haible
2021-04-27 23:47 ` Bruno Haible
2021-04-28 7:57 ` Florian Weimer via Libc-alpha
2021-04-28 14:40 ` Bruno Haible
2021-04-28 17:43 ` Florian Weimer via Libc-alpha
2021-04-29 15:15 ` Bruno Haible
2021-04-30 9:55 ` Florian Weimer via Libc-alpha
2021-04-29 6:33 ` Ben Pfaff via Libc-alpha
2021-05-03 1:44 ` Alan Modra via Libc-alpha
2021-07-12 10:04 ` Michael Hudson-Doyle via Libc-alpha
2021-07-12 15:03 ` Florian Weimer via Libc-alpha
2021-07-12 15:30 ` Matthias Klose
2021-07-12 15:37 ` Florian Weimer via Libc-alpha
2021-07-13 0:22 ` Michael Hudson-Doyle via Libc-alpha
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
List information: https://www.gnu.org/software/libc/involved.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87czugp61v.fsf@oldenburg.str.redhat.com \
--to=libc-alpha@sourceware.org \
--cc=binutils@sourceware.org \
--cc=bug-gnulib@gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=fweimer@redhat.com \
/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).