FreeBSD/libexec/rtld-elf/rtld.c
/*
 * Search the global objects, including dependencies and main object,
 * for the given symbol.
 */
Search the global objects, including dependencies and main object,
for the given symbol.
Search the global objects including dependencies and main object for the given symbol .
static int
symlook_global(SymLook *req, DoneList *donelist)
{
    SymLook req1;
    const Objlist_Entry *elm;
    int res;
    symlook_init_from_req(&req1, req);
    if (req->defobj_out == NULL ||
      ELF_ST_BIND(req->sym_out->st_info) == STB_WEAK) {
	res = symlook_list(&req1, &list_main, donelist);
	if (res == 0 && (req->defobj_out == NULL ||
	  ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK)) {
	    req->sym_out = req1.sym_out;
	    req->defobj_out = req1.defobj_out;
	    assert(req->defobj_out != NULL);
	}
    }
    STAILQ_FOREACH(elm, &list_global, link) {
	if (req->defobj_out != NULL &&
	  ELF_ST_BIND(req->sym_out->st_info) != STB_WEAK)
	    break;
	res = symlook_list(&req1, &elm->obj->dagmembers, donelist);
	if (res == 0 && (req->defobj_out == NULL ||
	  ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK)) {
	    req->sym_out = req1.sym_out;
	    req->defobj_out = req1.defobj_out;
	    assert(req->defobj_out != NULL);
	}
    }
    return (req->sym_out != NULL ? 0 : ESRCH);
}
static int symlook_global ( SymLook * req , DoneList * donelist ) { SymLook req1 ; const Objlist_Entry * elm ; int res ; symlook_init_from_req ( & req1 , req ) ; if ( req -> defobj_out == NULL || ELF_ST_BIND ( req -> sym_out -> st_info ) == STB_WEAK ) { res = symlook_list ( & req1 , & list_main , donelist ) ; if ( res == 0 && ( req -> defobj_out == NULL || ELF_ST_BIND ( req1 . sym_out -> st_info ) != STB_WEAK ) ) { req -> sym_out = req1 . sym_out ; req -> defobj_out = req1 . defobj_out ; assert ( req -> defobj_out != NULL ) ; } } STAILQ_FOREACH ( elm , & list_global , link ) { if ( req -> defobj_out != NULL && ELF_ST_BIND ( req -> sym_out -> st_info ) != STB_WEAK ) break ; res = symlook_list ( & req1 , & elm -> obj -> dagmembers , donelist ) ; if ( res == 0 && ( req -> defobj_out == NULL || ELF_ST_BIND ( req1 . sym_out -> st_info ) != STB_WEAK ) ) { req -> sym_out = req1 . sym_out ; req -> defobj_out = req1 . defobj_out ; assert ( req -> defobj_out != NULL ) ; } } return ( req -> sym_out != NULL ? 0 : ESRCH ) ; }
Search the global objects, including dependencies and main object,
 for the given symbol.
Search the global objects including dependencies and main object for the given symbol .
/* Search all objects loaded at program start up. */ /* Search all DAGs whose roots are RTLD_GLOBAL objects. */