From 75d4ea457191cd39b6da88becc5560039fc009ca Mon Sep 17 00:00:00 2001
From: Raymond Toy <toy.raymond@gmail.com>
Date: Tue, 10 May 2016 20:04:58 -0700
Subject: [PATCH] Add RELOCATABLE_STACK_START to control stack spaces for
 solaris/sparc..

When RELOCATABLE_STACK_START is defined, the control stack, binding
stack, and sigalt stack are located wherever mmap finds room for them.

Only implemented with sparc_sunc config.
---
 src/lisp/Config.sparc_sunc | 2 +-
 src/lisp/sparc-validate.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/lisp/Config.sparc_sunc b/src/lisp/Config.sparc_sunc
index 2e0b4e069..9c159320d 100644
--- a/src/lisp/Config.sparc_sunc
+++ b/src/lisp/Config.sparc_sunc
@@ -24,7 +24,7 @@ CC_V8PLUS = -m32 -xarch=sparc
 AS_V8PLUS = -m32 -xarch=sparc
 endif
 
-CFLAGS += -xlibmieee -O
+CFLAGS += -xlibmieee -O -DRELOCATABLE_STACK_START
 DEPEND_FLAGS = -xM
 ASFLAGS = $(AS_V8PLUS)
 OS_LINK_FLAGS = -M /usr/lib/ld/map.noexstk
diff --git a/src/lisp/sparc-validate.h b/src/lisp/sparc-validate.h
index b8fad15c6..2d34285c4 100644
--- a/src/lisp/sparc-validate.h
+++ b/src/lisp/sparc-validate.h
@@ -92,7 +92,7 @@
 #define READ_ONLY_SPACE_START	(SpaceStart_TargetReadOnly)
 #define READ_ONLY_SPACE_SIZE	((2*MB_128) - SPARSE_BLOCK_SIZE)	/* 256 MB - 32 KB, 256 MB max */
 
-#if 0
+#ifndef RELOCATABLE_STACK_START
 #define BINDING_STACK_START 	(0x20000000)
 #endif
 
@@ -101,7 +101,7 @@
 #define STATIC_SPACE_START  	(SpaceStart_TargetStatic)
 #define STATIC_SPACE_SIZE   	((2*MB_128) - SPARSE_BLOCK_SIZE)	/* 256 MB - 32 KB, 256 MB max */
 
-#if 0
+#ifndef RELOCATABLE_STACK_START
 #define CONTROL_STACK_START 	(0x38000000)
 #endif
 #define CONTROL_STACK_SIZE  	(MB_128 - SPARSE_BLOCK_SIZE)	/* 128 MB - 32 KB, 128 MB max */
-- 
GitLab