How to get 16-byte stack alignment in leaf functions

Andrew Haley
Tue Sep 10 09:42:00 GMT 2013

On 09/10/2013 01:21 AM, Dave Allured - NOAA Affiliate wrote:
> Hello, I am trying to create a dynamic library for
> x86_64-apple-darwin12 (Mac OS) with gcc 4.8.1.  My source code
> includes some simple functions that I think are being identified as
> leaf functions.  This works fine when compiling to a static library.
> However, when compiling to dynamic library (-dynamiclib etc.), seg
> fault results immediately on call from one of these leaf-like
> functions to another.  GDB tells me that the stack becomes misaligned
> in the calling function, and the actual seg fault happens within a
> dynamic loader stub function.  The simplified message from GDB is:
>    misaligned_stack_error_entering_dyld_stub_binder

What is the faulting instruction?

x/i $pc


More information about the Gcc-help mailing list