[v2,09/20] aarch64: Move saving user entry into _dl_start_user

Message ID 20240323173301.151066-10-bugaevc@gmail.com
State Failed CI
Series aarch64-gnu port & GNU/Hurd on AArch64 progress |


Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed

Commit Message

Sergey Bugaev March 23, 2024, 5:32 p.m. UTC
  In the Hurd ports, _dl_start () does not return the normal way; instead,
_dl_sysdep_start () jumps to _dl_start_user directly using the RETURN_TO
macro.  Unlike in the i386 and x86_64 ports, the instruction that was
saving the returned user entry into a different register (to avoid it
getting clobbered by the _dl_init () call) was not marked as a part of
_dl_start_user, causing it to be skipped when jumping to _dl_start_user
using RETURN_TO, and control subsequently getting transferred to a
random address left in x21.

This should not make any difference for Linux ports, other than the
_dl_start_user label pointing to an earlier instruction.

Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
 sysdeps/aarch64/dl-start.S | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/sysdeps/aarch64/dl-start.S b/sysdeps/aarch64/dl-start.S
index d645484e..e35431ca 100644
--- a/sysdeps/aarch64/dl-start.S
+++ b/sysdeps/aarch64/dl-start.S
@@ -29,10 +29,10 @@  ENTRY (_start)
 	PTR_ARG (0)
 	bl	_dl_start
 	/* Returns user entry point in x0.  */
-	mov	PTR_REG (21), PTR_REG (0)
 .globl _dl_start_user
 .type _dl_start_user, %function
+	mov	PTR_REG (21), PTR_REG (0)
 	/* Get argc.  */
 	ldr	PTR_REG (1), [sp]
 	/* Get argv.  */