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
This commit is contained in:
Doug Rabson 2005-05-19 07:32:42 +00:00
parent 0ff6455012
commit 9310a53def
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=146370

View File

@ -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