Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
Roland McGrath committed Sep 23, 2003
1 parent 2abf9ff commit 217ed70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
@@ -1,3 +1,10 @@
2003-09-23 Jakub Jelinek <jakub@redhat.com>

* 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.

2003-09-23 Roland McGrath <roland@redhat.com>

* sysdeps/i386/dl-machine.h (RTLD_START): Set __libc_stack_end before
Expand Down
13 changes: 5 additions & 8 deletions sysdeps/x86_64/dl-machine.h
Expand Up @@ -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\
Expand All @@ -284,16 +282,15 @@ _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\
leaq 8(%rsp), %rdx\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\
Expand Down

0 comments on commit 217ed70

Please sign in to comment.