public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [AArch64] use stack symbol provided by linker for nosys
@ 2017-08-11 13:55 Alexander Fedotov
  2017-08-14  8:21 ` Corinna Vinschen
  2017-08-15 12:47 ` Szabolcs Nagy
  0 siblings, 2 replies; 11+ messages in thread
From: Alexander Fedotov @ 2017-08-11 13:55 UTC (permalink / raw)
  To: newlib

[-- Attachment #1: Type: text/plain, Size: 102 bytes --]

Use the same approach for stack setup as for ARM when nosys is used.

Comments are appreciated.

Alex

[-- Attachment #2: aarch64_nosys_stack.patch --]
[-- Type: application/octet-stream, Size: 1935 bytes --]

From c049b628de5cd706721a57fa735c475bcde4ee5f Mon Sep 17 00:00:00 2001
From: Alexander Fedotov-B55613 <b55613@freescale.com>
Date: Fri, 11 Aug 2017 16:47:02 +0300
Subject: [PATCH] use stack from linker script when nosys

---
 libgloss/aarch64/crt0.S | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/libgloss/aarch64/crt0.S b/libgloss/aarch64/crt0.S
index 3bf0278..0c669d9 100644
--- a/libgloss/aarch64/crt0.S
+++ b/libgloss/aarch64/crt0.S
@@ -83,7 +83,7 @@
 	FUNC_START	_start
 
 /* Start by setting up a stack */
-
+#ifdef ARM_RDI_MONITOR
 	/*  Issue Angel SVC to read memory info.
 
 	    ptr to ptr to 4 words to receive data.  */
@@ -101,6 +101,10 @@
 	   exposed here in the HeapInfo Angel call.  */
 	ldr	x0, .LC0		/* point at returned values */
 	ldr	x1, [x0, #8]		/* get heap_limit */
+#else
+	/* Set up the stack pointer to a fixed value.  */
+	ldr     x1, .Lstack
+#endif
 #ifdef __ILP32__
 	/* Sanity check on the heap base.  */
 	ldr	x0, [x0]		/* get heap_base */
@@ -149,10 +153,12 @@
 	bl	FUNCTION (initialise_monitor_handles)
 #endif
 
+#ifdef __USES_INITFINI__
 	/* .init and .fini sections are used to create constructors
 	   and destructors.  Here we call the _init function and arrange
 	   for _fini to be called at program exit.  */
 	ldr	x0, .Lfini
+#endif
 	bl	FUNCTION (atexit)
 
 	bl	FUNCTION (_init)
@@ -237,14 +243,24 @@ FUNCTION (_cpu_init_hook):
 	ret
 
 	.align 3
+#ifdef ARM_RDP_MONITOR
 .LC0:
 	GEN_DWORD HeapBase
+#else
+.Lstack:
+	GEN_DWORD __stack
+
+	.weak __stack
+#endif
 .LC1:
 	GEN_DWORD __bss_start__
 .LC2:
 	GEN_DWORD __bss_end__
+#ifdef __USES_INITFINI__
 .Lfini:
 	GEN_DWORD FUNCTION(_fini)
+#endif
+#ifdef ARM_RDI_MONITOR
 .Lenvp:
 	GEN_DWORD env
 .Lcmdline:
@@ -268,3 +284,4 @@ CommandLine:	.space	256,0	/*  Maximum length of 255 chars handled.  */
 AngelSVCArgs:
 	GEN_DWORD CommandLine
 	.dword	255
+#endif
\ No newline at end of file
-- 
2.7.4


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-08-17 11:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-11 13:55 [AArch64] use stack symbol provided by linker for nosys Alexander Fedotov
2017-08-14  8:21 ` Corinna Vinschen
2017-08-15 12:47 ` Szabolcs Nagy
2017-08-15 13:35   ` Tamar Christina
2017-08-15 13:57     ` Alexander Fedotov
2017-08-15 14:06       ` Tamar Christina
2017-08-15 14:20         ` Alexander Fedotov
2017-08-15 15:55           ` Corinna Vinschen
2017-08-16 22:07             ` Szabolcs Nagy
2017-08-17 11:52               ` Szabolcs Nagy
2017-08-17 11:54                 ` Corinna Vinschen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).