This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: What is the right way to initialize GLibc?


On Sun, Aug 3, 2014 at 6:06 AM, Mike Frysinger <vapier@gentoo.org> wrote:
>
> On Fri 14 Mar 2014 23:13:40 Steven Stewart-Gallus wrote:
> > Suppose I'm experimenting with making an executable shared library
> > like GLibc itself is.

Please see http://stackoverflow.com/a/1451482/50617

TL;DR: building a PIE binary gives you ET_DYN that can be used as a
stand-alone binary, or as a shared library, and requires no hacks.

>
> I can get something simple like that working but
> > I want to do more and to do that I need to initialize libc. I think
> > the right way to do this is to call __libc_start_main manually in my
> > libraries start function but I don't know how to do that. What is the
> > right way to initialize GLibc?
>
> i'm afraid we've never speced this out and most likely never will.  there's so
> many little pieces spread over the crt/ldso/libc/etc...  that i'm not sure
> this is worthwhile.
>
> note that the way a shared app initializes is not the same as a static app.
> it is actually the ldso which starts execution when the app is shared and
> takes care of doing initialization before calling the app's main.
> -mike

-- 
Paul Pluzhnikov


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]