43 #define R_386_GLOB_DATA 6
44 #define R_386_JMP_SLOT 7
45 #define R_386_RELATIVE 8
46 #define R_386_GOTOFF 9
47 #define R_386_GOTPC 10
49 #define ELF32_R_TYPE(info) ((unsigned char)(info))
51 static char datamemory[ELFLOADER_DATAMEMORY_SIZE];
57 return (
void *)datamemory;
63 int fd = open(
"/dev/zero", O_RDWR);
64 char *mem = mmap(0, ELFLOADER_TEXTMEMORY_SIZE, PROT_WRITE | PROT_EXEC, MAP_PRIVATE, fd, 0);
72 cfs_read(fd, (
unsigned char *)mem, size);
77 struct elf32_rela *rela,
char *addr)
89 type = ELF32_R_TYPE(rela->r_info);
97 addr += rela->r_addend;
100 cfs_write(fd, (
char *)&addr, 4);
104 addr -= (sectionaddress + rela->r_offset);
105 addr += rela->r_addend;
108 cfs_write(fd, (
char *)&addr, 4);
112 printf(
"elfloader-x86.c: unsupported relocation type G + A - P (%d)\n", type);
115 printf(
"elfloader-x86.c: unsupported relocation type L + A - P (%d)\n", type);
117 case R_386_GLOB_DATA:
119 printf(
"elfloader-x86.c: unsupported relocation type S (%d)\n", type);
122 printf(
"elfloader-x86.c: unsupported relocation type B + A (%d)\n", type);
125 printf(
"elfloader-x86.c: unsupported relocation type S + A - GOT (%d)\n", type);
128 printf(
"elfloader-x86.c: unsupported relocation type GOT + A - P (%d)\n", type);
131 printf(
"elfloader-x86.c: unknown type (%d)\n", type);