* _start(ldso) & _start(crt)
@ 2014-04-21 19:41 writeonce
2014-04-21 20:25 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: writeonce @ 2014-04-21 19:41 UTC (permalink / raw)
To: musl
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?
Kind regards,
zg
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: _start(ldso) & _start(crt)
2014-04-21 19:41 _start(ldso) & _start(crt) writeonce
@ 2014-04-21 20:25 ` Rich Felker
2014-04-21 21:15 ` M Farkas-Dyck
0 siblings, 1 reply; 4+ messages in thread
From: Rich Felker @ 2014-04-21 20:25 UTC (permalink / raw)
To: musl
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: _start(ldso) & _start(crt)
2014-04-21 20:25 ` Rich Felker
@ 2014-04-21 21:15 ` M Farkas-Dyck
2014-04-21 21:39 ` Rich Felker
0 siblings, 1 reply; 4+ messages in thread
From: M Farkas-Dyck @ 2014-04-21 21:15 UTC (permalink / raw)
To: musl
Static-linked programs would be unaffected, yes?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: _start(ldso) & _start(crt)
2014-04-21 21:15 ` M Farkas-Dyck
@ 2014-04-21 21:39 ` Rich Felker
0 siblings, 0 replies; 4+ messages in thread
From: Rich Felker @ 2014-04-21 21:39 UTC (permalink / raw)
To: musl
On Mon, Apr 21, 2014 at 04:15:25PM -0500, M Farkas-Dyck wrote:
> Static-linked programs would be unaffected, yes?
Indeed, this has nothing to do with static linked programs.
Rich
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-04-21 21:39 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-21 19:41 _start(ldso) & _start(crt) writeonce
2014-04-21 20:25 ` Rich Felker
2014-04-21 21:15 ` M Farkas-Dyck
2014-04-21 21:39 ` Rich Felker
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/musl/
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 NNTP newsgroup(s).