Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2971 → Rev 2974

/branches/dynload/uspace/app/iloader/elf_load.c
49,9 → 49,6
#include "pcb.h"
#include "elf_load.h"
 
#define RTLD_BIAS 0x80000
//#define RTLD_BIAS 0
 
static char *error_codes[] = {
"no error",
"invalid image",
61,12 → 58,12
"irrecoverable error"
};
 
static unsigned int elf_load(elf_ld_t *elf);
static unsigned int elf_load(elf_ld_t *elf, size_t so_bias);
static int segment_header(elf_ld_t *elf, elf_segment_header_t *entry);
static int section_header(elf_ld_t *elf, elf_section_header_t *entry);
static int load_segment(elf_ld_t *elf, elf_segment_header_t *entry);
 
int elf_load_file(char *file_name, elf_info_t *info)
int elf_load_file(char *file_name, size_t so_bias, elf_info_t *info)
{
elf_ld_t elf;
 
84,7 → 81,7
elf.fd = fd;
elf.info = info;
 
rc = elf_load(&elf);
rc = elf_load(&elf, so_bias);
printf("elf_load() -> %d\n", rc);
 
close(fd);
124,7 → 121,7
* @param header Pointer to ELF header in memory
* @return EE_OK on success
*/
static unsigned int elf_load(elf_ld_t *elf)
static unsigned int elf_load(elf_ld_t *elf, size_t so_bias)
{
elf_header_t header_buf;
elf_header_t *header = &header_buf;
170,14 → 167,14
return EE_UNSUPPORTED;
}
 
/* The run-time dynamic linker is loaded with a bias */
/* Shared objects can be loaded with a bias */
printf("Object type: %d\n", header->e_type);
if (header->e_type == ET_DYN)
elf->bias = RTLD_BIAS;
elf->bias = so_bias;
else
elf->bias = 0;
 
printf("Bias set to 0x%d\n", elf->bias);
printf("Bias set to 0x%x\n", elf->bias);
 
printf("parse segments\n");