[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gnulib's obstack_* symbols in dynamic exports on glibc. Intentional?
From: |
Sergei Trofimovich |
Subject: |
gnulib's obstack_* symbols in dynamic exports on glibc. Intentional? |
Date: |
Fri, 30 Dec 2022 17:12:30 +0000 |
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
- gnulib's obstack_* symbols in dynamic exports on glibc. Intentional?,
Sergei Trofimovich <=