public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org>
To: glibc-cvs@sourceware.org
Subject: [glibc/arm/morello/main] aarch64: morello: rtld: add ld.so _start code
Date: Fri,  5 Aug 2022 19:36:26 +0000 (GMT)	[thread overview]
Message-ID: <20220805193626.0B542385B805@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=a0cbaef87cd3eda4667fdd3bc8df6b57dc7fc722

commit a0cbaef87cd3eda4667fdd3bc8df6b57dc7fc722
Author: Szabolcs Nagy <szabolcs.nagy@arm.com>
Date:   Tue Mar 29 16:30:33 2022 +0100

    aarch64: morello: rtld: add ld.so _start code
    
    The purecap version of aarch64 dl-start.S. Note: self relocation of
    ld.so is handled by the rtld bootstrap code.

Diff:
---
 sysdeps/aarch64/morello/dl-start.S | 68 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 68 insertions(+)

diff --git a/sysdeps/aarch64/morello/dl-start.S b/sysdeps/aarch64/morello/dl-start.S
new file mode 100644
index 0000000000..ea8d43522d
--- /dev/null
+++ b/sysdeps/aarch64/morello/dl-start.S
@@ -0,0 +1,68 @@
+/* ld.so _start code.
+   Copyright (C) 2022 Free Software Foundation, Inc.
+
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#include <sysdep.h>
+
+ENTRY(_start)
+
+	/* Create an initial frame with 0 LR and FP */
+	cfi_undefined (c30)
+	mov	c29, czr
+	mov	c30, czr
+	mov	c0, csp
+	bl	_dl_start
+	/* Returns user entry point in x0.  */
+	mov	c21, c0
+.globl _dl_start_user
+.type _dl_start_user, %function
+_dl_start_user:
+	/* Get argc.  */
+	ldr	x1, [csp]
+	/* Get argv.  */
+	add	c2, csp, 16
+	/* Compute envp.  */
+	add	c3, c2, x1, lsl 4
+	add	c3, c3, 16
+
+	adrp	c16, capinit_rtld_local
+	ldr	c16, [c16, :lo12:capinit_rtld_local]
+	ldr	c0, [c16]
+	bl	_dl_init
+	/* Load the finalizer function.  */
+	adrp	c0, capinit_dl_fini
+	ldr	c0, [c0, :lo12:capinit_dl_fini]
+	/* Jump to the user's entry point.  */
+	mov     c16, c21
+	br      c16
+END(_start)
+
+	.section	.data.rel.ro.local,"aw"
+	.align	4
+	.type	capinit_rtld_local, %object
+	.size	capinit_rtld_local, 16
+capinit_rtld_local:
+	.capinit	_rtld_local
+	.xword	0
+	.xword	0
+	.type	capinit_dl_fini, %object
+	.size	capinit_dl_fini, 16
+capinit_dl_fini:
+	.capinit	_dl_fini
+	.xword	0
+	.xword	0


                 reply	other threads:[~2022-08-05 19:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220805193626.0B542385B805@sourceware.org \
    --to=nsz@sourceware.org \
    --cc=glibc-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).