Re: How to get 16-byte stack alignment in leaf functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 11, 2013 at 2:53 AM, Andrew Haley <aph@xxxxxxxxxx> wrote:
> On 09/10/2013 05:35 PM, Dave Allured - NOAA Affiliate wrote:
>>> 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.
>
> OK, that makes sense.  Now, a leaf function cannot call a function: so,
> what is the assembly code of the "leaf-like" function makinf th ecall?
>
> Andrew.

My bad, I misunderstood the meaning of leaf function and lept to
assumptions.  Now I see that my problem probably has nothing to do
with leaf functions.  Thank you for correcting my novice mistake.

I would like to make a reduced test case and post it under a new title
that is hopefully not misleading.

--Dave




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux