summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/i386
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>2005-05-19 07:32:42 +0000
committerdfr <dfr@FreeBSD.org>2005-05-19 07:32:42 +0000
commit46ba1c3d373e6e1207a49bb8a190091eb180ee9f (patch)
treec06c71b03081b9ea014399e7965883773eaba671 /libexec/rtld-elf/i386
parente6963ec512a47d09e5f7ae62feb3ab7786a89598 (diff)
downloadFreeBSD-src-46ba1c3d373e6e1207a49bb8a190091eb180ee9f.zip
FreeBSD-src-46ba1c3d373e6e1207a49bb8a190091eb180ee9f.tar.gz
Align the stack to a 16 byte boundary before calling _rtld so that we can
safely initialise shared libraries that use SSE in their init sections. MFC After: 1 week
Diffstat (limited to 'libexec/rtld-elf/i386')
-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