svn commit: r231930 - projects/arm_eabi/libexec/rtld-elf/arm
Andrew Turner
andrew at FreeBSD.org
Mon Feb 20 08:56:11 UTC 2012
Author: andrew
Date: Mon Feb 20 08:56:10 2012
New Revision: 231930
URL: http://svn.freebsd.org/changeset/base/231930
Log:
Correctly align the stack before calling into C code.
We restore the stack before jumping to the entry point as _start needs the
stack in the same state as we were given it and also fixes the stack to be
correctly aligned.
Modified:
projects/arm_eabi/libexec/rtld-elf/arm/rtld_start.S
Modified: projects/arm_eabi/libexec/rtld-elf/arm/rtld_start.S
==============================================================================
--- projects/arm_eabi/libexec/rtld-elf/arm/rtld_start.S Mon Feb 20 06:35:52 2012 (r231929)
+++ projects/arm_eabi/libexec/rtld-elf/arm/rtld_start.S Mon Feb 20 08:56:10 2012 (r231930)
@@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$");
.globl .rtld_start
.type .rtld_start,%function
.rtld_start:
+ mov r6, sp /* save the stack pointer */
+ bic sp, sp, #7
sub sp, sp, #8 /* make room for obj_main & exit proc */
mov r4, r0 /* save ps_strings */
ldr sl, .L2
@@ -52,13 +54,13 @@ __FBSDID("$FreeBSD$");
bl _rtld_relocate_nonplt_self
mov r1, sp
add r2, sp, #4
- add r0, sp, #8
+ mov r0, r6 /* load the sp the kernel gave us */
bl _rtld /* call the shared loader */
mov r3, r0 /* save entry point */
ldr r2, [sp, #0] /* r2 = cleanup */
ldr r1, [sp, #4] /* r1 = obj_main */
- add sp, sp, #8 /* restore stack */
+ mov sp, r6 /* restore stack */
mov r0, r4 /* restore ps_strings */
mov pc, r3 /* jump to the entry point */
.L2:
More information about the svn-src-projects
mailing list