Subversion Repositories HelenOS

Rev

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

Rev 3562 Rev 3686
Line 75... Line 75...
75
 * Modules are compared according to their soname, i.e. possible
75
 * Modules are compared according to their soname, i.e. possible
76
 * path components are ignored.
76
 * path components are ignored.
77
 */
77
 */
78
module_t *module_find(char *name)
78
module_t *module_find(char *name)
79
{
79
{
80
    link_t *head = &runtime_env.modules_head;
80
    link_t *head = &runtime_env->modules_head;
81
 
81
 
82
    link_t *cur;
82
    link_t *cur;
83
    module_t *m;
83
    module_t *m;
84
    char *p, *soname;
84
    char *p, *soname;
85
 
85
 
-
 
86
    printf("got head ptr\n");
-
 
87
    printf(" = 0x%lx\n", (long) head);
-
 
88
 
86
    /*
89
    /*
87
     * If name contains slashes, treat it as a pathname and
90
     * If name contains slashes, treat it as a pathname and
88
     * construct soname by chopping off the path. Otherwise
91
     * construct soname by chopping off the path. Otherwise
89
     * treat it as soname.
92
     * treat it as soname.
90
     */
93
     */
91
    p = strrchr(name, '/');
94
    p = strrchr(name, '/');
92
    soname = p ? (p + 1) : name;
95
    soname = p ? (p + 1) : name;
-
 
96
 
-
 
97
    printf("did strrchr. soname='%s'\n", soname);
93
   
98
   
94
    /* Traverse list of all modules. Not extremely fast, but simple */
99
    /* Traverse list of all modules. Not extremely fast, but simple */
95
    for (cur = head->next; cur != head; cur = cur->next) {
100
    for (cur = head->next; cur != head; cur = cur->next) {
-
 
101
        printf("get_instance...\n");
96
        m = list_get_instance(cur, module_t, modules_link);
102
        m = list_get_instance(cur, module_t, modules_link);
97
        if (strcmp(m->dyn.soname, soname) == 0) {
103
        if (strcmp(m->dyn.soname, soname) == 0) {
98
            return m; /* Found */
104
            return m; /* Found */
99
        }
105
        }
100
    }
106
    }
Line 144... Line 150...
144
    DPRINTF("parse dynamic section\n");
150
    DPRINTF("parse dynamic section\n");
145
    /* Parse ELF .dynamic section. Store info to m->dyn. */
151
    /* Parse ELF .dynamic section. Store info to m->dyn. */
146
    dynamic_parse(info.dynamic, m->bias, &m->dyn);
152
    dynamic_parse(info.dynamic, m->bias, &m->dyn);
147
 
153
 
148
    /* Insert into the list of loaded modules */
154
    /* Insert into the list of loaded modules */
149
    list_append(&m->modules_link, &runtime_env.modules_head);
155
    list_append(&m->modules_link, &runtime_env->modules_head);
150
 
156
 
151
    return m;
157
    return m;
152
}
158
}
153
 
159
 
154
/** Load all modules on which m (transitively) depends.
160
/** Load all modules on which m (transitively) depends.
Line 207... Line 213...
207
    }
213
    }
208
}
214
}
209
 
215
 
210
void modules_process_relocs(void)
216
void modules_process_relocs(void)
211
{
217
{
212
    link_t *head = &runtime_env.modules_head;
218
    link_t *head = &runtime_env->modules_head;
213
 
219
 
214
    link_t *cur;
220
    link_t *cur;
215
    module_t *m;
221
    module_t *m;
216
 
222
 
217
    for (cur = head->next; cur != head; cur = cur->next) {
223
    for (cur = head->next; cur != head; cur = cur->next) {
218
        m = list_get_instance(cur, module_t, modules_link);
224
        m = list_get_instance(cur, module_t, modules_link);
219
 
225
 
220
        /* Skip rtld, since it has already been processed */
226
        /* Skip rtld, since it has already been processed */
221
        if (m != &runtime_env.rtld) {
227
        if (m != &runtime_env->rtld) {
222
            module_process_relocs(m);
228
            module_process_relocs(m);
223
        }
229
        }
224
    }
230
    }
225
}
231
}
226
 
232
 
227
/** Clear BFS tags of all modules.
233
/** Clear BFS tags of all modules.
228
 */
234
 */
229
void modules_untag(void)
235
void modules_untag(void)
230
{
236
{
231
    link_t *head = &runtime_env.modules_head;
237
    link_t *head = &runtime_env->modules_head;
232
 
238
 
233
    link_t *cur;
239
    link_t *cur;
234
    module_t *m;
240
    module_t *m;
235
 
241
 
236
    for (cur = head->next; cur != head; cur = cur->next) {
242
    for (cur = head->next; cur != head; cur = cur->next) {