This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: glibc initialization question
- From: Siddhesh Poyarekar <siddhesh dot poyarekar at gmail dot com>
- To: sellcey at cavium dot com
- Cc: libc-help <libc-help at sourceware dot org>
- Date: Tue, 18 Sep 2018 05:42:08 +0530
- Subject: Re: glibc initialization question
- References: <201809172309.w8HN9aRt015699@sellcey-dt.caveonetworks.com>
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