Subversion Repositories HelenOS

Rev

Rev 3686 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3686 Rev 3689
Line 53... Line 53...
53
    if (m == NULL) {
53
    if (m == NULL) {
54
        printf("NULL. module_load('%s')\n", path);
54
        printf("NULL. module_load('%s')\n", path);
55
        m = module_load(path);
55
        m = module_load(path);
56
        printf("module_load_deps(m)\n");
56
        printf("module_load_deps(m)\n");
57
        module_load_deps(m);
57
        module_load_deps(m);
-
 
58
        /* Now relocate. */
-
 
59
        printf("module_process_relocs(m)\n");
-
 
60
        module_process_relocs(m);
58
    } else {
61
    } else {
59
        printf("not NULL\n");
62
        printf("not NULL\n");
60
    }
63
    }
61
 
64
 
62
    return (void *) m;
65
    return (void *) m;
63
}
66
}
64
 
67
 
65
/*
68
/*
66
 * @note Symbols with NULL values are not accounted for.
69
 * @note Symbols with NULL values are not accounted for.
67
 * @note Symbol search scope is not correct. Should only
-
 
68
 *   look in @a mod and its dependencies.
-
 
69
 */
70
 */
70
void *dlsym(void *mod, const char *sym_name)
71
void *dlsym(void *mod, const char *sym_name)
71
{
72
{
72
    elf_symbol_t *sd;
73
    elf_symbol_t *sd;
73
    module_t *sm;
74
    module_t *sm;
74
 
75
 
75
    printf("dlsym(0x%lx, \"%s\")\n", (long)mod, sym_name);
76
    printf("dlsym(0x%lx, \"%s\")\n", (long)mod, sym_name);
76
    sd = symbol_def_find(sym_name, (module_t *) mod, &sm);
77
    sd = symbol_bfs_find(sym_name, (module_t *) mod, &sm);
77
    if (sd != NULL) {
78
    if (sd != NULL) {
78
        return symbol_get_addr(sd, sm);
79
        return symbol_get_addr(sd, sm);
79
    }
80
    }
80
 
81
 
81
    return NULL;
82
    return NULL;