aboutsummaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorStefan Weil <weil@mail.berlios.de>2010-08-09 16:43:53 +0200
committerBlue Swirl <blauwirbel@gmail.com>2010-09-09 19:37:16 +0000
commite403e433c1a30568a019cac9ba7301f8d5d7a382 (patch)
treeddaf531291af5b12dada6a0025fb785b5b45ba6c /hw
parentd7d9b528b105b9e27d9ffa5dd1f773d484a559b4 (diff)
elf: Calculate symbol size if needed
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>
Diffstat (limited to 'hw')
-rw-r--r--hw/elf_ops.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/hw/elf_ops.h b/hw/elf_ops.h
index 27d1ab9bc2..0bd72350b4 100644
--- a/hw/elf_ops.h
+++ b/hw/elf_ops.h
@@ -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;