Subversion Repositories HelenOS

Rev

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

Rev 3000 Rev 3400
Line 37... Line 37...
37
#include <stdio.h>
37
#include <stdio.h>
38
#include <stdlib.h>
38
#include <stdlib.h>
39
#include <unistd.h>
39
#include <unistd.h>
40
#include <fcntl.h>
40
#include <fcntl.h>
41
#include <libadt/list.h>
41
#include <libadt/list.h>
-
 
42
#include <loader/pcb.h>
42
 
43
 
43
#include <rtld.h>
44
#include <rtld.h>
44
#include <dynamic.h>
45
#include <dynamic.h>
45
#include <pcb.h>
-
 
46
#include <elf_load.h>
46
#include <elf_load.h>
47
#include <arch.h>
47
#include <rtld_arch.h>
48
#include <module.h>
48
#include <module.h>
49
 
49
 
50
/** (Eagerly) process all relocation tables in a module.
50
/** (Eagerly) process all relocation tables in a module.
51
 *
51
 *
52
 * Currently works as if LD_BIND_NOW was specified.
52
 * Currently works as if LD_BIND_NOW was specified.
Line 124... Line 124...
124
    if (strlen(name) > NAME_BUF_SIZE - 2) {
124
    if (strlen(name) > NAME_BUF_SIZE - 2) {
125
        printf("soname too long. increase NAME_BUF_SIZE\n");
125
        printf("soname too long. increase NAME_BUF_SIZE\n");
126
        exit(1);
126
        exit(1);
127
    }
127
    }
128
 
128
 
129
    /* Prepend soname with slash */
129
    /* Prepend soname with '/lib/' */
130
    name_buf[0] = '/';
130
    name_buf[0] = '/';
-
 
131
    strcpy(name_buf, "/lib/");
131
    strcpy(name_buf + 1, name);
132
    strcpy(name_buf + 5, name);
132
 
133
 
133
    /* FIXME: need to vary bias / allocate address space */
134
    /* FIXME: need to vary bias / allocate address space */
134
    m->bias = 0x20000;
135
    m->bias = 0x20000;
135
    printf("filename:'%s'\n", name_buf);
136
    printf("filename:'%s'\n", name_buf);
136
 
137
 
137
    rc = elf_load_file(name_buf, m->bias, &info);
138
    rc = elf_load_file(name_buf, m->bias, &info);
138
    if (rc < 0) {
139
    if (rc < 0) {
139
        printf("Failed to load '%s'\n");
140
        printf("Failed to load '%s'\n", name_buf);
140
        exit(1);
141
        exit(1);
141
    }
142
    }
142
 
143
 
143
    printf("parse dynamic section\n");
144
    printf("parse dynamic section\n");
144
    /* Parse ELF .dynamic section. Store info to m->dyn. */
145
    /* Parse ELF .dynamic section. Store info to m->dyn. */