]> git.proxmox.com Git - qemu.git/commitdiff
elf: Calculate symbol size if needed
authorStefan Weil <weil@mail.berlios.de>
Mon, 9 Aug 2010 14:43:53 +0000 (16:43 +0200)
committerBlue Swirl <blauwirbel@gmail.com>
Thu, 9 Sep 2010 19:37:16 +0000 (19:37 +0000)
Symbols with a size of 0 are unusable for the disassembler.

Example:

While running an arm linux kernel, no symbolic names are
used in qemu.log when the cpu is executing an assembler function.

Assume that the size of such symbols is the difference to the
next symbol value.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
hw/elf_ops.h

index 27d1ab9bc21a5543ff64cc436fa1228d2088ee20..0bd72350b4398744857e799462268c91180e9948 100644 (file)
@@ -153,6 +153,11 @@ static int glue(load_symbols, SZ)(struct elfhdr *ehdr, int fd, int must_swab,
         syms = qemu_realloc(syms, nsyms * sizeof(*syms));
 
         qsort(syms, nsyms, sizeof(*syms), glue(symcmp, SZ));
+        for (i = 0; i < nsyms - 1; i++) {
+            if (syms[i].st_size == 0) {
+                syms[i].st_size = syms[i + 1].st_value - syms[i].st_value;
+            }
+        }
     } else {
         qemu_free(syms);
         syms = NULL;