diff --git a/ChangeLog b/ChangeLog index 528df36a49..57bee5451c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-09-23 Jakub Jelinek + + * 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 * sysdeps/i386/dl-machine.h (RTLD_START): Set __libc_stack_end before 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\