From 168b87725a4295849a2870055f8f6459ec5b48f9 Mon Sep 17 00:00:00 2001 From: Stefan O'Rear Date: Wed, 11 Jan 2017 21:15:27 -0800 Subject: [PATCH] Remove brk special handling Reverts arsv/riscv-qemu@6268f398; this should fix the observed segfaults on statically linked binaries with the new linker script. --- linux-user/elfload.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index b0ebc21c587..a3a3725f408 100644 --- a/linux-user/elfload.c +++ b/linux-user/elfload.c @@ -1980,6 +1980,9 @@ static void load_elf_image(const char *image_name, int image_fd, if (vaddr_ef > info->end_data) { info->end_data = vaddr_ef; } + if (vaddr_em > info->brk) { + info->brk = vaddr_em; + } } } else if (eppnt->p_type == PT_INTERP && pinterp_name) { char *interp_name; @@ -2014,12 +2017,9 @@ static void load_elf_image(const char *image_name, int image_fd, if (info->end_data == 0) { info->start_data = info->end_code; info->end_data = info->end_code; + info->brk = info->end_code; } - /* Heap should be located past both .text and .data */ - info->brk = (info->end_code > info->end_data ? - info->end_code : info->end_data); - if (qemu_log_enabled()) { load_symbols(ehdr, image_fd, load_bias); }