public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: Re: [PATCH] Reduce the statically linked startup code [BZ #23323]
Date: Mon, 01 Mar 2021 10:43:40 +0100	[thread overview]
Message-ID: <87zgzni4z7.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <YDsx/YKfIctFzjUs@vapier> (Mike Frysinger's message of "Sun, 28 Feb 2021 01:02:37 -0500")

* Mike Frysinger:

>> What about this?
>> 
>> /* Note: This file is part of the startup code in statically linked
>>    programs.  From the statically linked startup code, dynamically
>>    linked programs call __libc_start_main in libc.so, which is compiled
>>    from this file as well, but not part of the statically linked startup
>>    code due to this separation.  */
>
> iiuc, libc-start ends up in libc.a & libc.so.  in both cases, it provides
> the __libc_start_main symbol, and in both cases, the crt object calls it.
>
> when you say "statically linked startup code", i'm guessing you're referring
> to the crt objects.
>
> so when you say "part of the startup code in statically linked programs", it
> makes it sound like this file is not used in shared programs which is not the
> case at all.
>
> how about:
> /* This file provides __libc_start_main which is responsible for initializing
>    the glibc runtime before transferring execution to the main function.  It is
>    called from the startup code statically linked into all programs (e.g. the
>    crt1.o object that provides the _start symbol).
>
>    In a statically linked program, it is linked directly into the image via the
>    libc.a archive.  In a dynamically linked program, it is part of libc.so.  */
> -mike

By being part of the startup code, I meant code that runs very early,
before full platform initialization (like the TCB).  In the statically
linked base, __libc_start_main is in that category.  But in the
dynamically linked case, it runs very late (after ELF constructors for
the initially loaded DSOs, for example).  This is an important
distinction, I think.

We can argue about this some more, or split the file in two. 8-)

Thanks,
Florian


  reply	other threads:[~2021-03-01  9:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-18 13:12 Florian Weimer
2021-02-25 11:00 ` Siddhesh Poyarekar
2021-02-25 18:43 ` Mike Frysinger
2021-02-25 18:52   ` Florian Weimer
2021-02-28  6:02     ` Mike Frysinger
2021-03-01  9:43       ` Florian Weimer [this message]
2021-03-07 16:39         ` Mike Frysinger
  -- strict thread matches above, loose matches on Subject: below --
2018-06-23 21:45 Florian Weimer
2018-07-01  9:30 ` Florian Weimer
2018-07-03 10:01 ` Florian Weimer
2018-08-08 14:48 ` Florian Weimer
2018-08-08 15:10   ` H.J. Lu
2018-08-08 15:17     ` Florian Weimer
2018-08-08 15:56   ` Szabolcs Nagy
2018-08-08 16:11     ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zgzni4z7.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).