summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libexec/rtld-elf/i386/rtld_start.S9
1 files changed, 6 insertions, 3 deletions
diff --git a/libexec/rtld-elf/i386/rtld_start.S b/libexec/rtld-elf/i386/rtld_start.S
index 76f1392..9a6e2d5 100644
--- a/libexec/rtld-elf/i386/rtld_start.S
+++ b/libexec/rtld-elf/i386/rtld_start.S
@@ -32,17 +32,20 @@
.rtld_start:
xorl %ebp,%ebp # Clear frame pointer for good form
movl %esp,%eax # Save initial stack pointer
- subl $8,%esp # A place to store exit procedure addr
+ movl %esp,%esi # Save initial stack pointer
+ andl $0xfffffff0,%esp # Align stack pointer
+ subl $16,%esp # A place to store exit procedure addr
movl %esp,%ebx # save address of exit proc
movl %esp,%ecx # construct address of obj_main
addl $4,%ecx
+ subl $4,%esp # Keep stack aligned
pushl %ecx # Pass address of obj_main
pushl %ebx # Pass address of exit proc
pushl %eax # Pass initial stack pointer to rtld
call _rtld@PLT # Call rtld(sp); returns entry point
- addl $12,%esp # Remove arguments from stack
+ addl $16,%esp # Remove arguments from stack
popl %edx # Get exit procedure address
- addl $4,%esp # Ignore obj_main
+ movl %esi,%esp # Ignore obj_main
/*
* At this point, %eax contains the entry point of the main program, and
* %edx contains a pointer to a termination function that should be
OpenPOWER on IntegriCloud