git: 5645dfb41ae0 - main - rtld: Sligtly optimizing .rtld_start on aarch64

From: Dmitry Chagin <dchagin_at_FreeBSD.org>
Date: Fri, 07 Jul 2023 16:56:20 UTC
The branch main has been updated by dchagin:

URL: https://cgit.FreeBSD.org/src/commit/?id=5645dfb41ae0d5ca0acdee8a2a6646787b33e03f

commit 5645dfb41ae0d5ca0acdee8a2a6646787b33e03f
Author:     Dmitry Chagin <dchagin@FreeBSD.org>
AuthorDate: 2023-07-07 16:55:08 +0000
Commit:     Dmitry Chagin <dchagin@FreeBSD.org>
CommitDate: 2023-07-07 16:55:08 +0000

    rtld: Sligtly optimizing .rtld_start on aarch64
    
    Use the LDP (load pair registers) instruction to load entry point
    arguments from the stack.
    
    Reviewed by:
    Differential Revision:  https://reviews.freebsd.org/D40843
---
 libexec/rtld-elf/aarch64/rtld_start.S | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/libexec/rtld-elf/aarch64/rtld_start.S b/libexec/rtld-elf/aarch64/rtld_start.S
index 196559d9d2bc..4f0bef0233b0 100644
--- a/libexec/rtld-elf/aarch64/rtld_start.S
+++ b/libexec/rtld-elf/aarch64/rtld_start.S
@@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$");
 
 ENTRY(.rtld_start)
 	mov	x19, x0		/* Put ps_strings in a callee-saved register */
-	mov	x20, sp		/* And the stack pointer */
 
 	sub	sp, sp, #16	/* Make room for obj_main & exit proc */
 
@@ -40,11 +39,9 @@ ENTRY(.rtld_start)
 	add	x2, x1, #8	/* obj_main */
 	bl	_rtld		/* Call the loader */
 	mov	x8, x0		/* Backup the entry point */
+	ldp	x2, x1, [sp], #16 /* Load cleanup, obj_main */
 
-	ldr	x2, [sp]	/* Load cleanup */
-	ldr	x1, [sp, #8]	/* Load obj_main */
 	mov	x0, x19		/* Restore ps_strings */
-	mov	sp, x20		/* Restore the stack pointer */
 	br	x8		/* Jump to the entry point */
 END(.rtld_start)