summary refs log tree commit diff
path: root/sysdeps/mach
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/mach')
-rw-r--r--sysdeps/mach/hurd/brk.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/mach/hurd/brk.c b/sysdeps/mach/hurd/brk.c
index c6eabb21d8..3a5ed54247 100644
--- a/sysdeps/mach/hurd/brk.c
+++ b/sysdeps/mach/hurd/brk.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991, 92, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991,92,93,94,95,96,97,99 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -41,6 +41,8 @@ weak_alias (_hurd_brk, ___brk_addr)
 struct mutex _hurd_brk_lock;
 
 extern int __data_start, _end;
+weak_extern (__data_start)
+static vm_address_t static_data_start;
 
 
 /* Set the end of the process's data space to INADDR.
@@ -81,7 +83,7 @@ _hurd_set_brk (vm_address_t addr)
   rlimit = _hurd_rlimits[RLIMIT_DATA].rlim_cur;
   __mutex_unlock (&_hurd_rlimit_lock);
 
-  if (addr - (vm_address_t) &__data_start > rlimit)
+  if (addr - static_data_start > rlimit)
     {
       /* Need to increase the resource limit.  */
       errno = ENOMEM;
@@ -114,6 +116,8 @@ init_brk (void)
 
   __mutex_init (&_hurd_brk_lock);
 
+  static_data_start = (vm_address_t) (&__data_start ?: &_end);
+
   /* If _hurd_brk is already set, don't change it.  The assumption is that
      it was set in a previous run before something like Emacs's unexec was
      called and dumped all the data up to the break at that point.  */
@@ -122,7 +126,7 @@ init_brk (void)
 
   pagend = round_page (_hurd_brk);
 
-  _hurd_data_end = round_page ((vm_address_t) &__data_start + DATA_SIZE);
+  _hurd_data_end = round_page (static_data_start + DATA_SIZE);
 
   if (pagend < _hurd_data_end)
     {