The runtime linker is responsible for calling the .init sections
of all dependencies.  crt1.s is responsible for calling the .init
section within the application (a.out) only.

The .init's for all dependencies are called *before* the applications
entry point _start, which is where the crt1.s execution starts.

The runtime linker knows the name of the application.

        if (dlinfo(dlopen(0, RTLD_LAZY), RTLD_DI_LINKMAP, &lmp) != -1)
                (void) printf("My name is: %s\n", lmp->l_name);

> And no, execname is actually not the correct thing to put in
> __progname.  It really is supposed to be argv[0], which may
> be different from the actual exec'ed program name.

Ahhh, but ld.so.1 knows the real name of the program, as passed to
it from the kernel.  And, getexecname(3c) would get you the same
information I suppose.

Perhaps use dlinfo(RTLD_DI_ARGSINFO) and scan the argv list?

-- 

Rod.

Reply via email to