diff options
author | andrew <andrew@FreeBSD.org> | 2012-08-04 05:30:20 +0000 |
---|---|---|
committer | andrew <andrew@FreeBSD.org> | 2012-08-04 05:30:20 +0000 |
commit | bff18849d07940559b372e037583678baf5adf31 (patch) | |
tree | 5c836a74295f7224cc00ddc1e4b3d89ac5db0239 | |
parent | dcbbf29bee04d5d6865d3b725fae95fbf4c76a78 (diff) | |
download | FreeBSD-src-bff18849d07940559b372e037583678baf5adf31.zip FreeBSD-src-bff18849d07940559b372e037583678baf5adf31.tar.gz |
Ensure we align the stack to 8 bytes in rtld.
This is not strictly required with the current ABI but will be when we
switch to the ARM EABI. The aapcs requires the stack to be 4 byte aligned
at all times and 8 byte aligned when calling a public subroutine where the
current ABI only requires sp to be a multiple of 4.
-rw-r--r-- | libexec/rtld-elf/arm/rtld_start.S | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/rtld-elf/arm/rtld_start.S b/libexec/rtld-elf/arm/rtld_start.S index b9de767..7a4fae4 100644 --- a/libexec/rtld-elf/arm/rtld_start.S +++ b/libexec/rtld-elf/arm/rtld_start.S @@ -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 /* align the stack pointer */ 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: |