summaryrefslogtreecommitdiff
path: root/src/unexelf.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2016-11-08 09:48:53 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2016-11-08 09:49:27 -0800
commit3b5e6774ed9743fb726ac8c15341eaa09375cfbf (patch)
tree08e5246f9f6311936689479346be05b801db4cf0 /src/unexelf.c
parent86baa208f84597068b3d55420eae0100a59e44b7 (diff)
downloademacs-3b5e6774ed9743fb726ac8c15341eaa09375cfbf.tar.gz
emacs-3b5e6774ed9743fb726ac8c15341eaa09375cfbf.tar.bz2
emacs-3b5e6774ed9743fb726ac8c15341eaa09375cfbf.zip
Port to FreeBSD 11 AMD
Problem reported by Ashish Shukla (Bug#24892). I tested this on FreeBSD 11 x86-64 with HAVE_SBRK manually undefined. * configure.ac (system_malloc): Set to 'yes' if there is no sbrk. (sbrk): Check whether it exists. * src/alloc.c (my_heap_start) [!GNU_LINUX]: Do not define, since this function is now used only on GNU/Linux, and sbrk might not exist on other platforms. (malloc_initialize_hook) [!GNU_LINUX]: Do not call my_heap_start, since its side effect will never be used. (Fmemory_limit) [!HAVE_SBRK]: Do not call sbrk. * src/unexelf.c (unexec) [!HAVE_SBRK]: Assume that nothing like sbrk exists.
Diffstat (limited to 'src/unexelf.c')
-rw-r--r--src/unexelf.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/unexelf.c b/src/unexelf.c
index 551915712fb..748e7a42cfa 100644
--- a/src/unexelf.c
+++ b/src/unexelf.c
@@ -329,7 +329,11 @@ unexec (const char *new_name, const char *old_name)
if (old_bss_index == -1)
fatal ("no bss section found");
+#ifdef HAVE_SBRK
new_break = sbrk (0);
+#else
+ new_break = (byte *) old_bss_addr + old_bss_size;
+#endif
new_bss_addr = (ElfW (Addr)) new_break;
bss_size_growth = new_bss_addr - old_bss_addr;
new_data2_size = bss_size_growth;