On Sat, Apr 22, 2023 at 7:20 PM Samuel Thibault <samuel.thiba...@gnu.org> wrote:
> But what about the memcpy calls from the RPC stubs used by the init
> code?

Ah, I see that we do actually call more than I thought before _start1.
In particular, we initialize the dtable (so the ctty stuff...) and get
our pid/pgrp from the proc server. We should probably do this later,
at time __libc_init_first probably. We want to do as little as
possible before _start1; we must get our argv and env, so that must
happen before _start1, and to do that we need to set up
__init_tcbhead, but the rest we can do later.

Guess I still like my GOT prefilling approach better then. It's not
that big of a hack, it's just two lines of assembly (we can drop
stpcpy, it's not used during early startup) and it makes memcpy just
work from anywhere (any RPCs, any other code) without any additional
trickery at use sites or in the build system. And all the same code
gets automatically upgraded to the better memcpy when it's available.
We know it works in practice and doesn't prevent ifunc selectors from
doing their thing later. What's not to like?

Sergey

Reply via email to