From 217ed70e1381922db0d0d7fa41e4938114848251 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Tue, 23 Sep 2003 21:31:54 +0000 Subject: * 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. --- sysdeps/x86_64/dl-machine.h | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'sysdeps/x86_64') 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\ -- cgit v1.2.3