diff options
author | kib <kib@FreeBSD.org> | 2011-11-02 18:08:30 +0000 |
---|---|---|
committer | kib <kib@FreeBSD.org> | 2011-11-02 18:08:30 +0000 |
commit | ca71676fe9906efdc910094ed5d53e6b06845789 (patch) | |
tree | a49b1a07625848937abda41fb0230feab224c78f /lib | |
parent | d5bbfd2b4a596efac124921b8eb84c0e9294fac1 (diff) | |
download | FreeBSD-src-ca71676fe9906efdc910094ed5d53e6b06845789.zip FreeBSD-src-ca71676fe9906efdc910094ed5d53e6b06845789.tar.gz |
Despite official i386 ABI does not mandate any stack alignment besides
the word alignment, some versions of gcc do require 16-byte alignment.
Make sure the stack is 16-byte aligned before calling a subroutine.
Inspired by: PR amd64/162214
MFC after: 1 week
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/i386/gen/setjmp.S | 14 | ||||
-rw-r--r-- | lib/libc/i386/gen/sigsetjmp.S | 14 |
2 files changed, 28 insertions, 0 deletions
diff --git a/lib/libc/i386/gen/setjmp.S b/lib/libc/i386/gen/setjmp.S index 5d0ddc4..a409e35 100644 --- a/lib/libc/i386/gen/setjmp.S +++ b/lib/libc/i386/gen/setjmp.S @@ -51,12 +51,19 @@ __FBSDID("$FreeBSD$"); ENTRY(setjmp) movl 4(%esp),%ecx PIC_PROLOGUE +#ifdef PIC + subl $12,%esp /* make the stack 16-byte aligned */ +#endif leal 28(%ecx), %eax pushl %eax /* (sigset_t*)oset */ pushl $0 /* (sigset_t*)set */ pushl $1 /* SIG_BLOCK */ call PIC_PLT(CNAME(_sigprocmask)) +#ifdef PIC + addl $24,%esp +#else addl $12,%esp +#endif PIC_EPILOGUE movl 4(%esp),%ecx movl 0(%esp),%edx @@ -76,12 +83,19 @@ END(setjmp) ENTRY(__longjmp) movl 4(%esp),%edx PIC_PROLOGUE +#ifdef PIC + subl $12,%esp /* make the stack 16-byte aligned */ +#endif pushl $0 /* (sigset_t*)oset */ leal 28(%edx), %eax pushl %eax /* (sigset_t*)set */ pushl $3 /* SIG_SETMASK */ call PIC_PLT(CNAME(_sigprocmask)) +#ifdef PIC + addl $24,%esp +#else addl $12,%esp +#endif PIC_EPILOGUE movl 4(%esp),%edx movl 8(%esp),%eax diff --git a/lib/libc/i386/gen/sigsetjmp.S b/lib/libc/i386/gen/sigsetjmp.S index 6487745..936edba 100644 --- a/lib/libc/i386/gen/sigsetjmp.S +++ b/lib/libc/i386/gen/sigsetjmp.S @@ -60,12 +60,19 @@ ENTRY(sigsetjmp) testl %eax,%eax jz 2f PIC_PROLOGUE +#ifdef PIC + subl $12,%esp /* make the stack 16-byte aligned */ +#endif leal 28(%ecx), %eax pushl %eax /* (sigset_t*)oset */ pushl $0 /* (sigset_t*)set */ pushl $1 /* SIG_BLOCK */ call PIC_PLT(CNAME(_sigprocmask)) +#ifdef PIC + addl $24,%esp +#else addl $12,%esp +#endif PIC_EPILOGUE movl 4(%esp),%ecx 2: movl 0(%esp),%edx @@ -87,12 +94,19 @@ ENTRY(__siglongjmp) cmpl $0,44(%edx) jz 2f PIC_PROLOGUE +#ifdef PIC + subl $12,%esp /* make the stack 16-byte aligned */ +#endif pushl $0 /* (sigset_t*)oset */ leal 28(%edx), %eax pushl %eax /* (sigset_t*)set */ pushl $3 /* SIG_SETMASK */ call PIC_PLT(CNAME(_sigprocmask)) +#ifdef PIC + addl $24,%esp +#else addl $12,%esp +#endif PIC_EPILOGUE movl 4(%esp),%edx 2: movl 8(%esp),%eax |