about summary refs log tree commit diff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-09-23 21:31:54 +0000
committerRoland McGrath <roland@gnu.org>2003-09-23 21:31:54 +0000
commit217ed70e1381922db0d0d7fa41e4938114848251 (patch)
tree52288dd85358a37d55662cf72c18f43e66e27f7d /sysdeps
parent2abf9ff11384a47dc456c138a8faf6b1469aac2b (diff)
downloadglibc-217ed70e1381922db0d0d7fa41e4938114848251.tar.gz
glibc-217ed70e1381922db0d0d7fa41e4938114848251.tar.xz
glibc-217ed70e1381922db0d0d7fa41e4938114848251.zip
* sysdeps/x86_64/dl-machine.h (RTLD_START): Set __libc_stack_end
	before calling _dl_start, using %rip relative access.
	Use %rip relative access to _dl_skip_args, _rtld_local._dl_loaded
	and _dl_fini.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/x86_64/dl-machine.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h
index aebdebf00d..2c497f6942 100644
--- a/sysdeps/x86_64/dl-machine.h
+++ b/sysdeps/x86_64/dl-machine.h
@@ -260,18 +260,16 @@ _dl_runtime_profile:\n\
 .globl _start\n\
 .globl _dl_start_user\n\
 _start:\n\
+	# Store the highest stack address\n\
+	movq %rsp, __libc_stack_end(%rip)\n\
 	movq %rsp, %rdi\n\
 	call _dl_start\n\
 _dl_start_user:\n\
 	# Save the user entry point address in %r12.\n\
 	movq %rax, %r12\n\
-	# Store the highest stack address\n\
-	movq __libc_stack_end@GOTPCREL(%rip), %rax\n\
-	movq %rsp, (%rax)\n\
 	# See if we were run as a command with the executable file\n\
 	# name as an extra leading argument.\n\
-	movq _dl_skip_args@GOTPCREL(%rip), %rax\n\
-	movl (%rax), %eax\n\
+	movl _dl_skip_args(%rip), %eax\n\
 	# Pop the original argument count.\n\
 	popq %rdx\n\
 	# Adjust the stack pointer to skip _dl_skip_args words.\n\
@@ -284,8 +282,7 @@ _dl_start_user:\n\
 	# argc -> rsi\n\
 	movq %rdx, %rsi\n\
 	# _dl_loaded -> rdi\n\
-	movq _rtld_local@GOTPCREL(%rip), %rdi\n\
-	movq (%rdi), %rdi\n\
+	movq _rtld_local(%rip), %rdi\n\
 	# env -> rcx\n\
 	leaq 16(%rsp,%rdx,8), %rcx\n\
 	# argv -> rdx\n\
@@ -293,7 +290,7 @@ _dl_start_user:\n\
 	# Call the function to run the initializers.\n\
 	call _dl_init_internal@PLT\n\
 	# Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\
-	movq _dl_fini@GOTPCREL(%rip), %rdx\n\
+	leaq _dl_fini(%rip), %rdx\n\
 	# Jump to the user's entry point.\n\
 	jmp *%r12\n\
 .previous\n\