]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Align the stack in _rtld_bind_start. Normally this is called with the
authorandrew <andrew@FreeBSD.org>
Sun, 6 Jul 2014 10:24:06 +0000 (10:24 +0000)
committerandrew <andrew@FreeBSD.org>
Sun, 6 Jul 2014 10:24:06 +0000 (10:24 +0000)
commitb9ea3f69fd05ad500b274d8808f12f0c96b30264
treeea205b606581cf436aad479e6595e4f90e92cc52
parent832ad256f9e19e41d418f827617f264f67899855
Align the stack in _rtld_bind_start. Normally this is called with the
correct stack alignment, however when we have a leaf function that uses
thread local storage it calls __aeabi_read_tp to get the thread pointer.
Neither GCC or clang see this as a function call so will align the stack
to a 4-byte boundary. This may be a problem as _rtld_bind expects to be
on an 8-byte boundary.

The solution is to store a copy of the stack pointer and force the
alignment before calling _rtld_bind.

This fixes a problem with armeb where applications would crash in odd ways.
It should also remove the need for a local patch to clang to force the
stack alignment to an 8-byte boundary, even for leaf functions. Further
testing will be needed before reverting this local change to clang as we
may rely on it in other places.

Reviewed by: jmg@
libexec/rtld-elf/arm/rtld_start.S