aboutsummaryrefslogtreecommitdiff
path: root/hw/elf_ops.h
diff options
context:
space:
mode:
Diffstat (limited to 'hw/elf_ops.h')
-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;