hvmloader: Simplify 32bit-bios relocator.

Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
This commit is contained in:
kfraser@localhost.localdomain committed 2007-03-15 10:38:06 +00:00
1 parent e18371883e
commit 11f0262cf2
1 file changed
+6 -7
+6 -7
View File
@@ -45,16 +45,11 @@ static int relocate_elf(unsigned char *elfarray) {
return -1;
}
for (i = 0; i < ehdr->e_shnum; i++) {
if (!(shdr[i]).sh_flags & SHF_ALLOC) {
shdr[i].sh_addr = 0;
continue;
}
for (i = 0; i < ehdr->e_shnum; i++)
shdr[i].sh_addr = (Elf32_Addr)&elfarray[shdr[i].sh_offset];
}
for (i = 0; i < ehdr->e_shnum; i++) {
if (shdr[i].sh_type == SHT_REL && shdr[i].sh_addr != 0) {
if (shdr[i].sh_type == SHT_REL) {
Elf32_Shdr *targetsec = (Elf32_Shdr *)&(shdr[shdr[i].sh_info]);
Elf32_Shdr *symtabsec = (Elf32_Shdr *)&(shdr[shdr[i].sh_link]);
Elf32_Sym *syms = (Elf32_Sym *)symtabsec->sh_addr;
@@ -62,6 +57,10 @@ static int relocate_elf(unsigned char *elfarray) {
unsigned char *code = (unsigned char *)targetsec->sh_addr;
int j;
/* must not have been stripped */
if (shdr[i].sh_size == 0)
return -6;
for (j = 0; j < shdr[i].sh_size / sizeof(Elf32_Rel); j++) {
int idx = ELF32_R_SYM(rels[j].r_info);
Elf32_Sym *symbol = &syms[idx];
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.