shithub: scc

Download patch

ref: 9ffa78545045faaed23195ef00d8cee0f1bf1db6
parent: e6128b22b6f016d1e0d22177f111a346e36d8705
author: Roberto E. Vargas Caballero <[email protected]>
date: Mon Oct 28 19:17:57 EDT 2019

[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.

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