public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* gnulib's obstack_* symbols in dynamic exports on glibc. Intentional?
@ 2022-12-30 17:12 Sergei Trofimovich
  2022-12-30 18:26 ` Bruno Haible
  0 siblings, 1 reply; 3+ messages in thread
From: Sergei Trofimovich @ 2022-12-30 17:12 UTC (permalink / raw)
  To: bug-gnulib; +Cc: libc-alpha

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnulib's obstack_* symbols in dynamic exports on glibc. Intentional?
  2022-12-30 17:12 gnulib's obstack_* symbols in dynamic exports on glibc. Intentional? Sergei Trofimovich
@ 2022-12-30 18:26 ` Bruno Haible
  2022-12-30 19:36   ` Sergei Trofimovich
  0 siblings, 1 reply; 3+ messages in thread
From: Bruno Haible @ 2022-12-30 18:26 UTC (permalink / raw)
  To: bug-gnulib; +Cc: libc-alpha, Sergei Trofimovich

Sergei Trofimovich wrote:
> 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

There's already a discussion on this topic, that started at
  https://lists.gnu.org/archive/html/bug-gnulib/2022-12/msg00007.html

Bruno




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: gnulib's obstack_* symbols in dynamic exports on glibc. Intentional?
  2022-12-30 18:26 ` Bruno Haible
@ 2022-12-30 19:36   ` Sergei Trofimovich
  0 siblings, 0 replies; 3+ messages in thread
From: Sergei Trofimovich @ 2022-12-30 19:36 UTC (permalink / raw)
  To: Bruno Haible; +Cc: bug-gnulib, libc-alpha

On Fri, 30 Dec 2022 19:26:48 +0100
Bruno Haible <bruno@clisp.org> wrote:

> Sergei Trofimovich wrote:
> > 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  
> 
> There's already a discussion on this topic, that started at
>   https://lists.gnu.org/archive/html/bug-gnulib/2022-12/msg00007.html

Aha, thank you!

-- 

  Sergei

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-12-30 19:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-30 17:12 gnulib's obstack_* symbols in dynamic exports on glibc. Intentional? Sergei Trofimovich
2022-12-30 18:26 ` Bruno Haible
2022-12-30 19:36   ` Sergei Trofimovich

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).