In _rtld(), reorder local declarations to compact the block and
partially sort them by style(9). Move locals declarations from nested blocks into the block at function start. Discussed with: emaste MFC after: 1 week
This commit is contained in:
parent
bd7459366e
commit
c4f7cccbe7
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=318256
@ -339,22 +339,16 @@ _LD(const char *var)
|
|||||||
func_ptr_type
|
func_ptr_type
|
||||||
_rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
_rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
||||||
{
|
{
|
||||||
Elf_Auxinfo *aux_info[AT_COUNT];
|
Elf_Auxinfo *aux, *auxp, *aux_info[AT_COUNT];
|
||||||
int i;
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
char **env;
|
|
||||||
Elf_Auxinfo *aux;
|
|
||||||
Elf_Auxinfo *auxp;
|
|
||||||
const char *argv0;
|
|
||||||
Objlist_Entry *entry;
|
Objlist_Entry *entry;
|
||||||
Obj_Entry *obj;
|
Obj_Entry *last_interposer, *obj, *preload_tail;
|
||||||
Obj_Entry *preload_tail;
|
const Elf_Phdr *phdr;
|
||||||
Obj_Entry *last_interposer;
|
|
||||||
Objlist initlist;
|
Objlist initlist;
|
||||||
RtldLockState lockstate;
|
RtldLockState lockstate;
|
||||||
char *library_path_rpath;
|
char **argv, *argv0, **env, *kexecpath, *library_path_rpath;
|
||||||
int mib[2];
|
caddr_t imgentry;
|
||||||
|
char buf[MAXPATHLEN];
|
||||||
|
int argc, fd, i, mib[2], phnum;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -477,7 +471,7 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
|||||||
* already loaded.
|
* already loaded.
|
||||||
*/
|
*/
|
||||||
if (aux_info[AT_EXECFD] != NULL) { /* Load the main program. */
|
if (aux_info[AT_EXECFD] != NULL) { /* Load the main program. */
|
||||||
int fd = aux_info[AT_EXECFD]->a_un.a_val;
|
fd = aux_info[AT_EXECFD]->a_un.a_val;
|
||||||
dbg("loading main program");
|
dbg("loading main program");
|
||||||
obj_main = map_object(fd, argv0, NULL);
|
obj_main = map_object(fd, argv0, NULL);
|
||||||
close(fd);
|
close(fd);
|
||||||
@ -485,10 +479,6 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
|||||||
rtld_die();
|
rtld_die();
|
||||||
max_stack_flags = obj->stack_flags;
|
max_stack_flags = obj->stack_flags;
|
||||||
} else { /* Main program already loaded. */
|
} else { /* Main program already loaded. */
|
||||||
const Elf_Phdr *phdr;
|
|
||||||
int phnum;
|
|
||||||
caddr_t entry;
|
|
||||||
|
|
||||||
dbg("processing main program's program header");
|
dbg("processing main program's program header");
|
||||||
assert(aux_info[AT_PHDR] != NULL);
|
assert(aux_info[AT_PHDR] != NULL);
|
||||||
phdr = (const Elf_Phdr *) aux_info[AT_PHDR]->a_un.a_ptr;
|
phdr = (const Elf_Phdr *) aux_info[AT_PHDR]->a_un.a_ptr;
|
||||||
@ -497,15 +487,12 @@ _rtld(Elf_Addr *sp, func_ptr_type *exit_proc, Obj_Entry **objp)
|
|||||||
assert(aux_info[AT_PHENT] != NULL);
|
assert(aux_info[AT_PHENT] != NULL);
|
||||||
assert(aux_info[AT_PHENT]->a_un.a_val == sizeof(Elf_Phdr));
|
assert(aux_info[AT_PHENT]->a_un.a_val == sizeof(Elf_Phdr));
|
||||||
assert(aux_info[AT_ENTRY] != NULL);
|
assert(aux_info[AT_ENTRY] != NULL);
|
||||||
entry = (caddr_t) aux_info[AT_ENTRY]->a_un.a_ptr;
|
imgentry = (caddr_t) aux_info[AT_ENTRY]->a_un.a_ptr;
|
||||||
if ((obj_main = digest_phdr(phdr, phnum, entry, argv0)) == NULL)
|
if ((obj_main = digest_phdr(phdr, phnum, imgentry, argv0)) == NULL)
|
||||||
rtld_die();
|
rtld_die();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aux_info[AT_EXECPATH] != NULL) {
|
if (aux_info[AT_EXECPATH] != NULL) {
|
||||||
char *kexecpath;
|
|
||||||
char buf[MAXPATHLEN];
|
|
||||||
|
|
||||||
kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr;
|
kexecpath = aux_info[AT_EXECPATH]->a_un.a_ptr;
|
||||||
dbg("AT_EXECPATH %p %s", kexecpath, kexecpath);
|
dbg("AT_EXECPATH %p %s", kexecpath, kexecpath);
|
||||||
if (kexecpath[0] == '/')
|
if (kexecpath[0] == '/')
|
||||||
|
Loading…
Reference in New Issue
Block a user