libc/setjump: Align stack at 16-bytes before function call
authorJohn Marino <draco@marino.st>
Tue, 11 Nov 2014 12:58:14 +0000 (13:58 +0100)
committerJohn Marino <draco@marino.st>
Tue, 11 Nov 2014 14:18:24 +0000 (15:18 +0100)
commita77a7390aa9dc46b32dbffb069a6bb801d599ede
treed6eb0b3b2f3d590bd887411599df7e87414d0307
parentee6361d4f8affdab1a874c4106e2bf806e4f8917
libc/setjump: Align stack at 16-bytes before function call

This is required by amd64 ABI.  Comments were added where stack was
"accidentally" properly aligned.  The problem manifested on with a
bus error when built by clang.

While here, preserve the floating float exceptions flags.  Per POSIX,
siglongjump() shall be equivalent to longjump() except that it must
match sigsetjump() instead of setjump() and except for the effect on the
signal mask.  Therefore it should preserve the FP exception flags.

Also add the GNU-stack notes, all libc object files are supposed to have
them (although I am pretty sure they don't).

Taken from:
FreeBSD svn 217106 (7 Jan 2011)
FreeBSD svn 227023 (2 Nov 2011)
FreeBSD svn 267307 (9 Jun 2014)
lib/libc/x86_64/gen/setjmp.S
lib/libc/x86_64/gen/sigsetjmp.S