GNU bug report logs - #24892
{s,}brk removed from FreeBSD 11.x and later, arm64 architecture

Previous Next

Package: emacs;

Reported by: ashish.is <at> lostca.se (Ashish SHUKLA)

Date: Mon, 7 Nov 2016 06:09:02 UTC

Severity: important

Tags: fixed, patch

Merged with 28308

Fixed in version 26.1

Done: Noam Postavsky <npostavs <at> users.sourceforge.net>

Bug is archived. No further changes may be made.

Full log


Message #104 received at 24892 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Ed Maste <emaste <at> freebsd.org>
Cc: freebsd-hackers <at> freebsd.org, Brooks Davis <brooks <at> freebsd.org>,
 24892 <at> debbugs.gnu.org, Ashish SHUKLA <ashish.is <at> lostca.se>
Subject: Re: bug#24892: {s, }brk removed from FreeBSD 11.x and later, arm64
 architecture
Date: Fri, 18 Nov 2016 14:22:07 -0800
Ed Maste wrote:
> arm64 support was first available in a release in FreeBSD 11.0, without sbrk, and sbrk never existed on the stable/11 branch.

Thanks, I didn't know that. So Emacs has never worked in this environment.

> it seems there's an implementation that allocates memory out of a large array in .bss used for some platforms - could we make use of that here?

Quite possibly. Unfortunately the code that uses that array (in gmalloc.c) also 
uses sbrk to move the break past the end of the large array. The large array is 
intended for use only during the build process; during ordinary execution, sbrk 
is used.

Perhaps Emacs could work around the problem by supplying a user-space sbrk 
emulator, which uses mmap to support the old-fashioned model where the heap is 
contiguous. Is that something that could be done easily? That is, is there some 
way to reserve the address space for a potentially-large Emacs heap right after 
.bss, such that library calls to malloc and mmap won't use this address space? 
That might do the trick.

Brooks Davis wrote:
> What does emacs actually need from sbrk()?  Could it get by with something with the same interface allocating from .bss or does it need its allocations to be at the end of .bss?

I think more the latter. The problem with a fixed-size .bss is that whatever 
size we pick during the build is likely to be wrong for users. Also, Emacs saves 
the entire build-time .bss into an executable, so an enormous .bss will be 
counterproductive.




This bug report was last modified 7 years and 201 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.