scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 9ffa78545045faaed23195ef00d8cee0f1bf1db6
parent e6128b22b6f016d1e0d22177f111a346e36d8705
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon, 28 Oct 2019 23:17:57 +0100

[libc] Simplify _getheap() in posix

Almost all the POSIX system have the symbol end, so the simplest way
to define _getheap is to use end. If some system does not support
end then it can use _brk() or some other form.

Diffstat:
Asrc/libc/arch/amd64/dragonfly/_getheap.c | 1+
Dsrc/libc/arch/amd64/dragonfly/_getheap.s | 6------
Asrc/libc/arch/amd64/linux/_getheap.c | 1+
Dsrc/libc/arch/amd64/linux/_getheap.s | 6------
Asrc/libc/arch/amd64/netbsd/_getheap.c | 1+
Dsrc/libc/arch/amd64/netbsd/_getheap.s | 6------
Asrc/libc/arch/amd64/openbsd/_getheap.c | 1+
Dsrc/libc/arch/amd64/openbsd/_getheap.s | 6------
Asrc/libc/arch/arm32/linux/_getheap.c | 1+
Dsrc/libc/arch/arm32/linux/_getheap.s | 6------
Asrc/libc/arch/arm64/linux/_getheap.c | 1+
Dsrc/libc/arch/arm64/linux/_getheap.s | 6------
Asrc/libc/arch/posix/_getheap.c | 9+++++++++
13 files changed, 15 insertions(+), 36 deletions(-)

diff --git a/src/libc/arch/amd64/dragonfly/_getheap.c b/src/libc/arch/amd64/dragonfly/_getheap.c @@ -0,0 +1 @@ +#include "../../posix/_getheap.c" diff --git a/src/libc/arch/amd64/dragonfly/_getheap.s b/src/libc/arch/amd64/dragonfly/_getheap.s @@ -1,6 +0,0 @@ - .file "_getheap.s" - - .globl _getheap -_getheap: - movq $end,%rax - retq diff --git a/src/libc/arch/amd64/linux/_getheap.c b/src/libc/arch/amd64/linux/_getheap.c @@ -0,0 +1 @@ +#include "../../posix/_getheap.c" diff --git a/src/libc/arch/amd64/linux/_getheap.s b/src/libc/arch/amd64/linux/_getheap.s @@ -1,6 +0,0 @@ - .file "_getheap.s" - - .globl _getheap -_getheap: - movq $0,%rax - jmp _brk diff --git a/src/libc/arch/amd64/netbsd/_getheap.c b/src/libc/arch/amd64/netbsd/_getheap.c @@ -0,0 +1 @@ +#include "../../posix/_getheap.c" diff --git a/src/libc/arch/amd64/netbsd/_getheap.s b/src/libc/arch/amd64/netbsd/_getheap.s @@ -1,6 +0,0 @@ - .file "_getheap.s" - - .globl _getheap -_getheap: - movq $end,%rax - retq diff --git a/src/libc/arch/amd64/openbsd/_getheap.c b/src/libc/arch/amd64/openbsd/_getheap.c @@ -0,0 +1 @@ +#include "../../posix/_getheap.c" diff --git a/src/libc/arch/amd64/openbsd/_getheap.s b/src/libc/arch/amd64/openbsd/_getheap.s @@ -1,6 +0,0 @@ - .file "_getheap.s" - - .globl _getheap -_getheap: - movq $end,%rax - retq diff --git a/src/libc/arch/arm32/linux/_getheap.c b/src/libc/arch/arm32/linux/_getheap.c @@ -0,0 +1 @@ +#include "../../posix/_getheap.c" diff --git a/src/libc/arch/arm32/linux/_getheap.s b/src/libc/arch/arm32/linux/_getheap.s @@ -1,6 +0,0 @@ - .file "_getheap.s" - - .globl _getheap -_getheap: - mov r0,#0 - b _brk diff --git a/src/libc/arch/arm64/linux/_getheap.c b/src/libc/arch/arm64/linux/_getheap.c @@ -0,0 +1 @@ +#include "../../posix/_getheap.c" diff --git a/src/libc/arch/arm64/linux/_getheap.s b/src/libc/arch/arm64/linux/_getheap.s @@ -1,6 +0,0 @@ - .file "_getheap.s" - - .globl _getheap -_getheap: - mov x0,#0 - b _brk diff --git a/src/libc/arch/posix/_getheap.c b/src/libc/arch/posix/_getheap.c @@ -0,0 +1,9 @@ +#include "../../libc.h" + +void * +_getheap(void) +{ + extern char end[]; + + return end; +}