[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] hvmloader: Simplify 32bit-bios relocator.



# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1173955086 0
# Node ID 5bc5ed857cc6dd7a60442a52f10a35fa16c6fa89
# Parent  aa6914c527e107deba0bcc5c9c89525814085d61
hvmloader: Simplify 32bit-bios relocator.
Signed-off-by: Stefan Berger <stefanb@xxxxxxxxxx>
---
 tools/firmware/hvmloader/32bitbios_support.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff -r aa6914c527e1 -r 5bc5ed857cc6 
tools/firmware/hvmloader/32bitbios_support.c
--- a/tools/firmware/hvmloader/32bitbios_support.c      Thu Mar 15 10:36:10 
2007 +0000
+++ b/tools/firmware/hvmloader/32bitbios_support.c      Thu Mar 15 10:38:06 
2007 +0000
@@ -45,22 +45,21 @@ static int relocate_elf(unsigned char *e
         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;
             Elf32_Rel  *rels      = (Elf32_Rel *)shdr[i].sh_addr;
             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);

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.