FreeBSD/libexec/rtld-elf/rtld.c
/*
 * Search the chain of DAGS cointed to by the given Needed_Entry
 * for a symbol of the given name.  Each DAG is scanned completely
 * before advancing to the next one.  Returns a pointer to the symbol,
 * or NULL if no definition was found.
 */
Search the chain of DAGS cointed to by the given Needed_Entry
for a symbol of the given name.  Each DAG is scanned completely
before advancing to the next one.  Returns a pointer to the symbol,
or NULL if no definition was found.
Search the chain of DAGS cointed to by the given Needed_Entry for a symbol of the given name . Each DAG is scanned completely before advancing to the next one . Returns a pointer to the symbol or NULL if no definition was found .
static int
symlook_needed(SymLook *req, const Needed_Entry *needed, DoneList *dlp)
{
    const Elf_Sym *def;
    const Needed_Entry *n;
    const Obj_Entry *defobj;
    SymLook req1;
    int res;
    def = NULL;
    defobj = NULL;
    symlook_init_from_req(&req1, req);
    for (n = needed; n != NULL; n = n->next) {
	if (n->obj == NULL ||
	    (res = symlook_list(&req1, &n->obj->dagmembers, dlp)) != 0)
	    continue;
	if (def == NULL || ELF_ST_BIND(req1.sym_out->st_info) != STB_WEAK) {
	    def = req1.sym_out;
	    defobj = req1.defobj_out;
	    if (ELF_ST_BIND(def->st_info) != STB_WEAK)
		break;
	}
    }
    if (def != NULL) {
	req->sym_out = def;
	req->defobj_out = defobj;
	return (0);
    }
    return (ESRCH);
}
static int symlook_needed ( SymLook * req , const Needed_Entry * needed , DoneList * dlp ) { const Elf_Sym * def ; const Needed_Entry * n ; const Obj_Entry * defobj ; SymLook req1 ; int res ; def = NULL ; defobj = NULL ; symlook_init_from_req ( & req1 , req ) ; for ( n = needed ; n != NULL ; n = n -> next ) { if ( n -> obj == NULL || ( res = symlook_list ( & req1 , & n -> obj -> dagmembers , dlp ) ) != 0 ) continue ; if ( def == NULL || ELF_ST_BIND ( req1 . sym_out -> st_info ) != STB_WEAK ) { def = req1 . sym_out ; defobj = req1 . defobj_out ; if ( ELF_ST_BIND ( def -> st_info ) != STB_WEAK ) break ; } } if ( def != NULL ) { req -> sym_out = def ; req -> defobj_out = defobj ; return ( 0 ) ; } return ( ESRCH ) ; }
Search the chain of DAGS cointed to by the given Needed_Entry
 for a symbol of the given name.
Search the chain of DAGS cointed to by the given Needed_Entry for a symbol of the given name .