Just cleanups, commented out unused code.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2435 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-01-12 16:54:38 +00:00
parent 2a2cf1b8f5
commit 077020137d

View File

@ -4,9 +4,9 @@
** Distributed under the terms of the NewOS License. ** Distributed under the terms of the NewOS License.
*/ */
static
int static int
relocate_rel(image_t *image, struct Elf32_Rel *rel, int rel_len ) relocate_rel(image_t *image, struct Elf32_Rel *rel, int rel_len)
{ {
int i; int i;
struct Elf32_Sym *sym; struct Elf32_Sym *sym;
@ -18,11 +18,11 @@ relocate_rel(image_t *image, struct Elf32_Rel *rel, int rel_len )
# define A (*(P)) # define A (*(P))
# define B (image->regions[0].delta) # define B (image->regions[0].delta)
for(i = 0; i * (int)sizeof(struct Elf32_Rel) < rel_len; i++) { for (i = 0; i * (int)sizeof(struct Elf32_Rel) < rel_len; i++) {
unsigned type= ELF32_R_TYPE(rel[i].r_info); unsigned type = ELF32_R_TYPE(rel[i].r_info);
switch(ELF32_R_TYPE(rel[i].r_info)) { switch (ELF32_R_TYPE(rel[i].r_info)) {
case R_386_32: case R_386_32:
case R_386_PC32: case R_386_PC32:
case R_386_GLOB_DAT: case R_386_GLOB_DAT:
@ -35,41 +35,41 @@ relocate_rel(image_t *image, struct Elf32_Rel *rel, int rel_len )
return vlErr; return vlErr;
} }
} }
switch(type) { switch (type) {
case R_386_NONE: case R_386_NONE:
continue; continue;
case R_386_32: case R_386_32:
final_val= S+A; final_val = S + A;
break; break;
case R_386_PC32: case R_386_PC32:
final_val=S+A-(addr)P; final_val = S + A - (addr)P;
break; break;
#if 0 #if 0
case R_386_GOT32: case R_386_GOT32:
final_val= G+A; final_val = G + A;
break; break;
case R_386_PLT32: case R_386_PLT32:
final_val= L+A-(addr)P; final_val = L + A - (addr)P;
break; break;
#endif #endif
case R_386_COPY: case R_386_COPY:
/* what ? */ /* what ? */
continue; continue;
case R_386_GLOB_DAT: case R_386_GLOB_DAT:
final_val= S; final_val = S;
break; break;
case R_386_JMP_SLOT: case R_386_JMP_SLOT:
final_val= S; final_val = S;
break; break;
case R_386_RELATIVE: case R_386_RELATIVE:
final_val= B+A; final_val = B + A;
break; break;
#if 0 #if 0
case R_386_GOTOFF: case R_386_GOTOFF:
final_val= S+A-GOT; final_val = S + A - GOT;
break; break;
case R_386_GOTPC: case R_386_GOTPC:
final_val= GOT+A-P; final_val = GOT + A - P;
break; break;
#endif #endif
default: default:
@ -77,55 +77,51 @@ relocate_rel(image_t *image, struct Elf32_Rel *rel, int rel_len )
return ERR_NOT_ALLOWED; return ERR_NOT_ALLOWED;
} }
*P= final_val; *P = final_val;
} }
# undef P # undef P
# undef A # undef A
# undef B # undef B
return B_NO_ERROR; return B_NO_ERROR;
} }
/* /*
* rldelf.c requires this function to be implemented on a per-cpu basis * rldelf.c requires this function to be implemented on a per-cpu basis
*/ */
static static bool
bool
relocate_image(image_t *image) relocate_image(image_t *image)
{ {
int res = B_NO_ERROR; status_t status = B_NO_ERROR;
int i;
if(image->flags & RFLAG_RELOCATED) { if (image->flags & RFLAG_RELOCATED)
return true; return true;
}
image->flags|= RFLAG_RELOCATED; image->flags |= RFLAG_RELOCATED;
// deal with the rels first // deal with the rels first
if(image->rel) { if (image->rel) {
res= relocate_rel( image, image->rel, image->rel_len ); status = relocate_rel(image, image->rel, image->rel_len);
if (status)
if(res) {
return false; return false;
}
} }
if(image->pltrel) { if (image->pltrel) {
res= relocate_rel(image, image->pltrel, image->pltrel_len); status = relocate_rel(image, image->pltrel, image->pltrel_len);
if (status)
if(res) {
return false; return false;
}
} }
if(image->rela) { if (image->rela) {
//int i;
printf("RELA relocations not supported\n"); printf("RELA relocations not supported\n");
return ERR_NOT_ALLOWED; return false;
for(i = 1; i * (int)sizeof(struct Elf32_Rela) < image->rela_len; i++) {
printf("rela: type %d\n", ELF32_R_TYPE(image->rela[i].r_info)); //for (i = 1; i * (int)sizeof(struct Elf32_Rela) < image->rela_len; i++) {
} // printf("rela: type %d\n", ELF32_R_TYPE(image->rela[i].r_info));
//}
} }
return true; return true;