Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2960 → Rev 2961

/branches/dynload/uspace/app/iloader/elf.c
57,7 → 57,7
};
 
static int segment_header(int fd, elf_header_t *elf);
static int section_header(elf_section_header_t *entry, elf_header_t *elf);
static int section_header(int fd, elf_header_t *elf);
static int load_segment(int fd, elf_segment_header_t *entry, elf_header_t *elf);
 
typedef void (*epoint_t)(void);
115,8 → 115,9
/* Walk through all segment headers and process them. */
for (i = 0; i < header->e_phnum; i++) {
 
/* Seek to start of header */
lseek(fd, header->e_phoff + i * sizeof(elf_segment_header_t), SEEK_SET);
/* Seek to start of segment header */
lseek(fd, header->e_phoff + i * sizeof(elf_segment_header_t),
SEEK_SET);
 
rc = segment_header(fd, header);
if (rc != EE_OK)
127,13 → 128,14
 
/* Inspect all section headers and proccess them. */
for (i = 0; i < header->e_shnum; i++) {
/* elf_section_header_t *sechdr;
 
sechdr = &((elf_section_header_t *)(((uint8_t *) header) +
header->e_shoff))[i];
rc = section_header(sechdr, header);
/* Seek to start of section header */
lseek(fd, header->e_shoff + i * sizeof(elf_section_header_t),
SEEK_SET);
 
rc = section_header(fd, header);
if (rc != EE_OK)
return rc;*/
return rc;
}
 
printf("done\n");
293,8 → 295,15
*
* @return EE_OK on success, error code otherwise.
*/
static int section_header(elf_section_header_t *entry, elf_header_t *elf)
static int section_header(int fd, elf_header_t *elf)
{
static elf_section_header_t entry_buf;
elf_section_header_t *entry = &entry_buf;
int rc;
 
rc = read(fd, entry, sizeof(elf_section_header_t));
if (rc < 0) { printf("read error\n"); return EE_INVALID; }
 
switch (entry->sh_type) {
case SHT_PROGBITS:
if (entry->sh_flags & SHF_TLS) {
306,6 → 315,9
/* .tbss */
}
break;
case SHT_DYNAMIC:
printf("dynamic section found\n");
break;
default:
break;
}