From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/4940 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: _start(ldso) & _start(crt) Date: Mon, 21 Apr 2014 16:25:32 -0400 Message-ID: <20140421202531.GI26358@brightrain.aerifal.cx> References: <53557463.2050202@midipix.org> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1398111955 18460 80.91.229.3 (21 Apr 2014 20:25:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 21 Apr 2014 20:25:55 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-4944-gllmg-musl=m.gmane.org@lists.openwall.com Mon Apr 21 22:25:48 2014 Return-path: Envelope-to: gllmg-musl@plane.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1WcKmg-0005OH-H1 for gllmg-musl@plane.gmane.org; Mon, 21 Apr 2014 22:25:46 +0200 Original-Received: (qmail 13697 invoked by uid 550); 21 Apr 2014 20:25:45 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 13685 invoked from network); 21 Apr 2014 20:25:44 -0000 Content-Disposition: inline In-Reply-To: <53557463.2050202@midipix.org> User-Agent: Mutt/1.5.21 (2010-09-15) Original-Sender: Rich Felker Xref: news.gmane.org gmane.linux.lib.musl.general:4940 Archived-At: On Mon, Apr 21, 2014 at 03:41:23PM -0400, writeonce@midipix.org wrote: > Greetings, > > When running a dynamically linked program, the general control flow is > > _start(ldso/{arch}/start.s) --> __dynlink --> _start(crt) --> > __libc_start_main --> main() > > When asking gdb to set up a breakpoint at _start (b _start), gdb's > confirmation message shows the address of _start(crt), but it then > breaks at _start(ldso), which is actually what I want. It then > later also breaks at _start(crt). > > If gdb decided to only break at the executable's _start, then I > believe there would be no way to request a break at the > interpreter's (ldso) _start routine, since the address of ldso's > _start is not known prior to execution. > > I am not sure whether this is a good-enough motivation to rename > ldso's start to _ldso_start (and set libc.so's entry point > accordingly), or whether we could simply count on gdb and other > debuggers to continue to do the "right thing" by breaking at the > earlier _start of the two. For one thing, setting a breakpoint at > __dynlink provides pretty much the same debugging ability as with > _start(ldso), and does not require any changes. Any thoughts? The motivation for the name _start in the dynamic linker was presumably that it gets used by default as the entry point, but we already have -Wl,-e,_start anyway, so I don't see any compelling reason it couldn't be renamed. Does anyone else object to changing it? Rich