Re: [PATCH] i386: fix stack alignment for signal handlers

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

 



On Tue, Sep 13, 2005 at 04:52:30PM -0700, Linus Torvalds wrote:
> Your test program does seems to imply that gcc wants the alignment before
> the return address (ie it prints out an address that is 4 bytes offset),
> but on the other hand I'm not even sure how careful gcc is about this
> alignment thing at all.

Very, on architectures where the ABI requires alignment.  E.G. for
vector register loads that require 16-byte alignment to avoid a trap.

The comment for the relevant bits of the GCC configuration says it
won't assume this for x86, but I believe that comment is out of date.
I think it'll assume 16-byte alignment on entrance to non-main()
functions.

> In the "main()" function, gcc will actually generate a "andl $-16,%esp" to 
> force the alignment, but ot in the handler function. Just a gcc special 
> case? Random luck?

Special case.  This is only done for main().

-- 
Daniel Jacobowitz
CodeSourcery, LLC
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux