glibc initialization question

Siddhesh Poyarekar siddhesh.poyarekar@gmail.com
Tue Sep 18 00:12:00 GMT 2018


On Tue, 18 Sep 2018 at 04:39, Steve Ellcey <sellcey@cavium.com> wrote:
> I have a question about how ARCH_INIT_CPU_FEATURE is called in a
> shared vs. non-shared glibc.  I think I knew this once but I can't
> remember how it worked.  When SHARED is not set and we are
> building a static glibc, LIBC_START_MAIN calls ARCH_INIT_CPU_FEATURE
> to do the various initialization.  What I can't figure out is how
> ARCH_INIT_CPU_FEATURE is called for a shared glibc.  I am assuming
> that a static constructor function is put into the shared glibc
> somewhere and that calls ARCH_INIT_CPU_FEATURE, but I can't find
> where that would be happening.  Can someone point me to the right
> place or explain how it works if it isn't done via a static
> constructor?  I see the comment in LIBC_START_MAIN about _dl_start_user
> but I don't see how _dl_start or _dl_start_user gets me to
> ARCH_INIT_CPU_FEATURE.

For [SHARED] It's called in _dl_sysdep_start through DL_PLATFORM_INIT.
It's in elf/dl-sysdep.c.

Siddhesh

-- 
http://siddhesh.in



More information about the Libc-help mailing list