From: Sergei Trofimovich <slyich@gmail.com>
To: bug-gnulib@gnu.org
Cc: libc-alpha@sourceware.org
Subject: gnulib's obstack_* symbols in dynamic exports on glibc. Intentional?
Date: Fri, 30 Dec 2022 17:12:30 +0000 [thread overview]
Message-ID: <Y68b/nf+PSNBiDmI@nz> (raw)
Hello bug-gnulib (and libc-alpha, CCed)!
The other day I was looking at simplest programs to make sure they don't
normally have dynamic exports. I picked coreutils-9.1 'ls'. And to my
surprise it did have one a set of dynamically exported symbols:
$ nm -D `which ls` | grep -v '^ '
00000000004c0d40 T _obstack_allocated_p
0000000000534808 D obstack_alloc_failed_handler
00000000004c0bd0 T _obstack_begin
00000000004c0bf0 T _obstack_begin_1
00000000004c0d80 T _obstack_free
00000000004c0e00 T _obstack_memory_used
00000000004c0c10 T _obstack_newchunk
That was a surprise to me. I think they are exported because gnulib
defines them in obstack.c.
AFAIU gnulib assumes that local implementation is better that glibc's
as it supports 64-bit object sizes.
I think ld decides to put symbols into dynamic exports to make sure
local symbols intended to override glibc's need to propagate to glibc
and other libraries that might use it.
Questions:
1. Is it a safe override to mangle symbols ilke that?
Or would glibc's versioned symbols be used just fine by existing
libraries?
$ nm -D /lib/libc.so.6 | fgrep obstack
0000000000201338 B _obstack@GLIBC_2.2.5
000000000009aa70 T _obstack_allocated_p@@GLIBC_2.2.5
00000000001fb338 D obstack_alloc_failed_handler@@GLIBC_2.2.5
000000000009a780 T _obstack_begin@@GLIBC_2.2.5
000000000009a840 T _obstack_begin_1@@GLIBC_2.2.5
00000000001fa208 D obstack_exit_failure@@GLIBC_2.2.5
000000000009aab0 T _obstack_free@@GLIBC_2.2.5
000000000009aab0 T obstack_free@@GLIBC_2.2.5
000000000009ab40 T _obstack_memory_used@@GLIBC_2.2.5
000000000009a900 T _obstack_newchunk@@GLIBC_2.2.5
000000000007e110 W obstack_printf@@GLIBC_2.2.5
000000000011e9c0 T __obstack_printf_chk@@GLIBC_2.8
000000000007e100 W obstack_vprintf@@GLIBC_2.2.5
000000000011ea80 T __obstack_vprintf_chk@@GLIBC_2.8
2. Would it be feasible to avoid dynamic symbol export and maybe rename
gnulib's symbols to avoid clash with glibc?
I would expect loading to be a tiny bit faster for binaries without
dynamic exports like that.
Thanks!
--
Sergei
next reply other threads:[~2022-12-30 17:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-30 17:12 Sergei Trofimovich [this message]
2022-12-30 18:26 ` gnulib's obstack_* symbols in dynamic exports on glibc. Intentional? Bruno Haible
2022-12-30 19:36 ` Sergei Trofimovich
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://lists.gnu.org/mailman/listinfo/bug-gnulib
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y68b/nf+PSNBiDmI@nz \
--to=slyich@gmail.com \
--cc=bug-gnulib@gnu.org \
--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).