Cross Reference: rtld_start.S
xref: /src/libexec/ld.elf_so/arch/x86_64/rtld_start.S
  • Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /src/libexec/ld.elf_so/arch/x86_64/
rtld_start.S revision 1.1
1/*	$NetBSD: rtld_start.S,v 1.1 2001/06/19 01:11:44 fvdl Exp $	*/
2
3#include <machine/asm.h>
4
5	.text
6	.align	16
7	.globl	.rtld_start
8	.type	.rtld_start,@function
9.rtld_start:
10	subq	$16,%rsp		# make room of obj_main and exit proc
11	movq	%rsp,%rdi		# stack pointer arg to _rtld
12	pushq	%rbx			# save ps_strings
13
14	call	_rtld@PLT		# _rtld(sp)
15
16	popq	%rbx			# %rbx = ps_strings
17	popq	%rdx			# %rdx = cleanup
18	popq	%rcx			# %rcx = obj_main
19	jmp	*%rax
20
21	.align	4
22	.globl	_rtld_bind_start
23	.type	_rtld_bind_start,@function
24_rtld_bind_start:	# (obj, reloff)
25	pushfq				# save caller-saved registers
26	pushq	%rax
27	pushq	%rcx
28	pushq	%rdx
29	pushq	%rsi
30	pushq	%rdi
31	pushq	%r8
32	pushq	%r9
33	pushq	%r10
34	pushq	%r11
35
36	call	_rtld_bind@PLT		# call the binder
37	movq	%rax,80(%rsp)		# store function in return address
38
39	popq	%r11
40	popq	%r10
41	popq	%r9
42	popq	%r8
43	popq	%rdi
44	popq	%rsi
45	popq	%rdx
46	popq	%rcx
47	popq	%rax
48	popfq
49
50	ret
51

Indexes created Mon Nov 10 17:20:41 GMT 2025