public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/ARM/heads/morello)] Add a capability version of the crti.S and crtn.S files
@ 2021-09-21 9:13 Matthew Malcomson
0 siblings, 0 replies; only message in thread
From: Matthew Malcomson @ 2021-09-21 9:13 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:3d93394b6134556de82bb8ae9e7b9e10faa6d93d
commit 3d93394b6134556de82bb8ae9e7b9e10faa6d93d
Author: Matthew Malcomson <matthew.malcomson@arm.com>
Date: Mon Aug 9 10:51:00 2021 +0100
Add a capability version of the crti.S and crtn.S files
These files define the FUNC_START and FUNC_END macros to implement the
function prologues and epilogues for the .init and .fini sections.
It seems the implementation in libgcc is just to save the callee-saved
registers, so we simply do that for the pure capability version too.
Diff:
---
libgcc/config/aarch64/crti.S | 17 +++++++++++++++++
libgcc/config/aarch64/crtn.S | 19 +++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/libgcc/config/aarch64/crti.S b/libgcc/config/aarch64/crti.S
index b105b93756c..bd4697f5b04 100644
--- a/libgcc/config/aarch64/crti.S
+++ b/libgcc/config/aarch64/crti.S
@@ -37,6 +37,22 @@
#define TYPE(x)
#endif
+#ifdef __CHERI_PURE_CAPABILITY__
+
+ # Note - this macro is complemented by the FUNC_END macro
+ # in crtn.S. If you change this macro you must also change
+ # that macro to match.
+.macro FUNC_START
+ # Create a stack frame and save any call-preserved registers
+ stp c29, c30, [csp, #-32]!
+ stp c27, c28, [csp, #-32]!
+ stp c25, c26, [csp, #-32]!
+ stp c23, c24, [csp, #-32]!
+ stp c21, c22, [csp, #-32]!
+ stp c19, c20, [csp, #-32]!
+.endm
+#else
+
# Note - this macro is complemented by the FUNC_END macro
# in crtn.S. If you change this macro you must also change
# that macro match.
@@ -50,6 +66,7 @@
stp x19, x20, [sp, #-16]!
.endm
+#endif
.section ".init"
.align 2
.global _init
diff --git a/libgcc/config/aarch64/crtn.S b/libgcc/config/aarch64/crtn.S
index 109c0cb449b..c23e37335c6 100644
--- a/libgcc/config/aarch64/crtn.S
+++ b/libgcc/config/aarch64/crtn.S
@@ -31,6 +31,24 @@
# fact return. Users may put any desired instructions in those sections.
# This file is the last thing linked into any executable.
+
+#ifdef __CHERI_PURE_CAPABILITY__
+
+ # Note - this macro is complemented by the FUNC_START macro
+ # in crti.S. If you change this macro you must also change
+ # that macro to match.
+.macro FUNC_END
+ # Restore all save registers including the link register, and then
+ # perform the correct function return instruction.
+ ldp c19, c20, [csp], #32
+ ldp c21, c22, [csp], #32
+ ldp c23, c24, [csp], #32
+ ldp c25, c26, [csp], #32
+ ldp c27, c28, [csp], #32
+ ldp c29, c30, [csp], #32
+ ret
+.endm
+#else
# Note - this macro is complemented by the FUNC_START macro
# in crti.S. If you change this macro you must also change
# that macro match.
@@ -49,6 +67,7 @@
ret
.endm
+#endif
.section ".init"
;;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-09-21 9:13 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-21 9:13 [gcc(refs/vendors/ARM/heads/morello)] Add a capability version of the crti.S and crtn.S files Matthew Malcomson
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).