From: Stefan Weil Date: Mon, 9 Aug 2010 14:43:53 +0000 (+0200) Subject: elf: Calculate symbol size if needed X-Git-Tag: v0.14.0-rc0~694 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e403e433c1a30568a019cac9ba7301f8d5d7a382;p=thirdparty%2Fqemu.git 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 Signed-off-by: Blue Swirl --- diff --git a/hw/elf_ops.h b/hw/elf_ops.h index 27d1ab9bc21..0bd72350b43 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;