> 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 >> On Tue, Sep 10, 2013 at 3:42 AM, Andrew Haley <aph@xxxxxxxxxx> wrote: > What is the faulting instruction? > > x/i $pc movdqa, an SSE instruction that requires 16-byte alignment. This is about a dozen instructions within the dynamic loader. (gdb) stepi 0x00007fff85ac68a5 in misaligned_stack_error_entering_dyld_stub_binder () 3: $rsp = (void *) 0x7fff5fbfe5f8 2: $rbp = (void *) 0x7fff5fbfe6b8 1: x/i $pc 0x7fff85ac68a5 <misaligned_stack_error_entering_dyld_stub_binder>: movdqa %xmm0,0x40(%rsp) (gdb) stepi Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: 13 at address: 0x0000000000000000 0x00007fff85ac68a5 in misaligned_stack_error_entering_dyld_stub_binder () --Dave