]> git.eshelyaron.com Git - emacs.git/commitdiff
Port to FreeBSD 11 AMD
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 8 Nov 2016 17:48:53 +0000 (09:48 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 8 Nov 2016 17:49:27 +0000 (09:49 -0800)
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.

configure.ac
src/alloc.c
src/unexelf.c

index f67fe83081ef822290897516a6966157fbc5bccc..7450e2f7274afe2ee6f4c0473f308c450e2fb6ad 100644 (file)
@@ -2151,14 +2151,14 @@ AC_CACHE_CHECK(
    fi])
 doug_lea_malloc=$emacs_cv_var_doug_lea_malloc
 
-system_malloc=$emacs_cv_sanitize_address
-
 hybrid_malloc=
+system_malloc=yes
 
 case "$opsys" in
   ## darwin ld insists on the use of malloc routines in the System framework.
-  darwin | mingw32 | nacl | sol2-10) system_malloc=yes ;;
+  darwin | mingw32 | nacl | sol2-10) ;;
   cygwin) hybrid_malloc=yes;;
+  *) test "$ac_cv_func_sbrk" = yes && system_malloc=$emacs_cv_sanitize_address;;
 esac
 
 if test "${system_malloc}" != yes && test "${doug_lea_malloc}" != yes \
@@ -4155,7 +4155,7 @@ AC_CHECK_HEADERS(valgrind/valgrind.h)
 
 AC_CHECK_MEMBERS([struct unipair.unicode], [], [], [[#include <linux/kd.h>]])
 
-AC_CHECK_FUNCS_ONCE(tzset)
+AC_CHECK_FUNCS_ONCE([sbrk tzset])
 
 ok_so_far=yes
 AC_CHECK_FUNC(socket, , ok_so_far=no)
index a58dc13cbd7dc5b84ea992278417e1609d9149e6..90c6f9441faf96183744bdf67087c104e13a3fce 100644 (file)
@@ -97,7 +97,7 @@ static bool valgrind_p;
 #include "w32heap.h"   /* for sbrk */
 #endif
 
-#if defined DOUG_LEA_MALLOC || defined GNU_LINUX
+#ifdef GNU_LINUX
 /* The address where the heap starts.  */
 void *
 my_heap_start (void)
@@ -130,7 +130,9 @@ malloc_initialize_hook (void)
 
   if (! initialized)
     {
+#ifdef GNU_LINUX
       my_heap_start ();
+#endif
       malloc_using_checking = getenv ("MALLOC_CHECK_") != NULL;
     }
   else
@@ -7053,7 +7055,7 @@ We divide the value by 1024 to make sure it fits in a Lisp integer.  */)
 {
   Lisp_Object end;
 
-#ifdef HAVE_NS
+#if defined HAVE_NS || !HAVE_SBRK
   /* Avoid warning.  sbrk has no relation to memory allocated anyway.  */
   XSETINT (end, 0);
 #else
index 551915712fb95c40fa95eb8dee5da289afea39d0..748e7a42cfa1834b03d562676d0af1c9e9459555 100644 (file)
@@ -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;